我使用FormBuilderInterface来创建我的表单,所以我发现我可以使用函数is有效值()来验证我的表单,我对handleRequest($request)有一个问题,我不知道它的作用是什么。这是我的代码:
function ajout2Action()
{
$client= new \Esprit\PiBundle\Entity\Client();
$formv= new \Esprit\PiBundle\Form\ClientType();
$form= $this->createForm($formv,$client);
$request = $this->get('request');
if($form->handleRequest($request)->isValid())
{
$em=$this->getDoctrine()->getManager();
$em->persist($client);
$em->flush();
}谢谢你的帮助。
https://stackoverflow.com/questions/34425762
复制相似问题