使用Symfony 2.7,您可以使用“getName()
现在不推荐使用”方法自定义EntityType类中的表单名称。使用Symfony 3.0还有另一种方法吗?
我有自定义原型entry_rows,用于需要以不同形式使用的集合。
由于行的名称基于表单的名称,因此我将需要更改后者,以便将它们用于其他表单。
您应该实现该getBlockPrefix
方法,而不要getName
按照此处的迁移指南中的说明实施。
例如:
/**
* Returns the prefix of the template block name for this type.
*
* The block prefix defaults to the underscored short class name with
* the "Type" suffix removed (e.g. "UserProfileType" => "user_profile").
*
* @return string The prefix of the template block name
*/
public function getBlockPrefix()
{
return "form_name";
}
希望这个帮助
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句