I've created a many to many relation and generated crud via command line. I have Users and Groups.
USER
/**
* @ORM\ManyToMany(targetEntity="Grup", mappedBy="users")
* @ORM\JoinTable(name="user_has_grup",
* joinColumns={@ORM\JoinColumn(name="grup_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")}
* )
*/
protected $grups;
Grup
/**
* @ORM\ManyToMany(targetEntity="User", inversedBy="grups")
* @ORM\JoinTable(name="user_has_grup",
* joinColumns={@ORM\JoinColumn(name="grup_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")}
* )
*/
protected $users;
When i create user group show up but i can't assign user to group. Still when i go to edit Group i can assign User to it and its works well.
What do I need to change, if i want to be able do it in both directions? Is there any Doctrine Entity change or in controller ?