我想在 createEditForm() 方法中获取表单错误。我一直在尝试这个 $editForm->getErrors(); 但它每次甚至有错误都返回 0 错误。这是我的代码:
public function createEventEditForm($entity, array $entityProperties)
{
$editForm = parent::createEditForm($entity, $entityProperties);
if($entity instanceof Event){
//dump($editForm->getErrors()); die;
//dump($editForm->getErrors()->count()); die;
$event_id = $this->request->query->get('id');
if(!$editForm->getErrors()->count()){
$event = new Event();
$event->setStatus(Event::STATUS_INACTIVE);
$this->getDoctrine()->getManager()->flush();
}
}
return $editForm;
}
谁能帮我?提前致谢