/** * UserEntity is the 'Owning side' * @see http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#owning-and-inverse-side-on-a-manytomany-association * @param GroupEntity $group */ public function addGroup(GroupEntity $group) { $group->addUser($this); $this->groups[] = $group; }