'Symfony3' - 'fosuserbundle' form - add group to user

删除回忆录丶 提交于 2019-12-11 06:01:49

问题


I use Symfony 3 with the fosuserbundle, and want to create a form, that will add multiple groups to one user.

The layout is not the problem, but to building the form and submitting...

Here is the sourcecode with the important parts:
https://pastebin.com/tyFP8XGK

The current problem is that if I have a user (in my case it is an admin) have any group, I can't add one or more groups and submit without error, BUT if I edit the admin, the groups aren't preselected in the choise, AND if I submit (with no group, one group or more groups) I will be get the error:

Expected argument of type "FOS\UserBundle\Model\GroupInterface", "integer" given

I don't know what I can do to fix it...

来源:https://stackoverflow.com/questions/48050116/symfony3-fosuserbundle-form-add-group-to-user

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