I have a Group Entity with the following class member and mapping:
/**
* @ManyToMany(targetEntity="Group", cascade={"persist"})
* @JoinTable(name="groups_children",
* joinColumns={@JoinColumn(name="group_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="child_id", referencedColumnName="id", unique=true)}
* )
*/
private $children;
Adding a child is trivial:
public function addChild(Group $group)
{
if (! $this->hasChild($group)) {
$this->children[] = $group;
App::getEntityManager()->persist($this);
}
}
Removing a child:
???????
How would I remove a child?