'Symfony3' - 'fosuserbundle' form

2019-08-02 14:35发布

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...

0条回答
登录 后发表回答