我正在使用 FormBuilderInterface 来创建我的表单,所以我发现我可以使用函数 isvalid() 验证我的表单,我有一个 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();
}
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助 。
| 归档时间: |
|
| 查看次数: |
7510 次 |
| 最近记录: |