堆栈是 symf 5 和 EA 3。我在为一个 AssociationField 显示不同数据时遇到问题。我想为不同的角色显示该字段的不同值。查询构建器在 Symfony 表单中所做的事情。有什么帮助吗?
1 回答
You probably need to create a switch statement in the CRUD Controller which will render that field differently based on what is the current user role. Remember, that one user can have multiple roles by default, so You need to specify which role index should it take to statement as a parameter.
But the true question is: Do You really need that functionality? If so, You probably should consider giving Your user class additionally a configuration array, where You will store the config of the preferred way for data presentation.
You do not tell much about the background of Your problem, so I hope my answer address it correctly.