Symfony2 translate form entity property

断了今生、忘了曾经 提交于 2019-12-24 08:49:04

问题


I have a symfony2 form for edit users. My users has roles and you can select multiple roles for one user.

In my form I display the UserRoles entity:

$builder->add( 'rolesAsObject', 'entity', array( 'label' => 'roles', 'class' => 'AcmeUserBundle:UserRoles', 'multiple' => true, 'property' => 'name' ) );

This works correctly, but the name property is just a number, an id for a language key, because I would like to translate the name of the roles.

Is this possible to call a function somehow on the property?

来源:https://stackoverflow.com/questions/16479052/symfony2-translate-form-entity-property

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!