I am trying to remove ManyToMany relationships inside Doctrine 2. I have two entities - Userand TargetGroup.
In my object User, I have:
private $targetGroups;
In my object TargetGroup, I have:
private $users;
I'm trying to call:
$user->removeTargetGroup($targetGroup);
$targetGroup->removeUser($user);
$em->persist($user);
$em->persist($targetGroup);
$em->flush();
Two methods used:
public function removeTargetGroup(Path To Bundle $targetGroups)
{
$this->targetGroups->removeElement($targetGroups);
}
public function removeUser(Path To Bundle $users)
{
$this->users->removeElement($users);
}
This is not an error, but it also does not fulfill any removal requests.
Any suggestions?
source
share