【发布时间】:2013-06-27 14:18:22
【问题描述】:
我正在尝试将实体放入自己的表单中。懒得记个getData()方法,但是form里面不存在,不记得怎么用了。
有什么方法可以在不使用事件监听器的情况下获取 buildform 方法中的实体?
我的意思是,像这样:
public function buildForm(FormBuilderInterface $builder, array $options)
{
/*some method to get the entity of the form such as getEntity????????*/
$builder->add('field');
}
【问题讨论】: