我想获取表单内部的实体。我记得有一个名为getData()的方法,但它并不存在于表单内部,而且我也不记得如何使用它。
有没有办法在buildform方法中获取实体,而不使用事件监听器?
我的意思是像这样:
public function buildForm(FormBuilderInterface $builder, array $options)
{
/*some method to get the entity of the form such as getEntity????????*/
$builder->add('field');
}