I\'m following the security chapter of the Symfony 2 book.
There\'s is an example with a table USERS and GROUPS. There is a many-to
In addition to @Ethan's answer, one-way remove is not working. For such manyToMany relationship, you have to call the remove methods from both entities, for example,
$user = $em->findOneById($userId);
$group = $em->findOneById($groupId);
$user->removeGroup($group);
$group->removeUser($user);
$em->persist($user);
$em->flush();