我正在使用AnnotationForms
并且我将教程中的标准编辑操作更改为使用注释而不是标准表单。
一切正常,除了$form->bind()
不填写值。表单字段保持空白。
我检查了应该绑定的变量,它已设置并且看起来不错。
这是我的行动:
$id = (int)$this->getEvent()->getRouteMatch()->getParam('id');
if (!$id) {
return $this->redirect()->toRoute('album', array('action'=>'add'));
}
$album = $this->getEntityManager()->find('Album\Entity\Album', $id);
$builder = new AnnotationBuilder();
$form = $builder->createForm(new \Album\Entity\Album());
$form->add(new \MyVendor\Form\MyFieldset());
$form->setBindOnValidate(false);
$form->bind($album);