/** * @param Entity\User $user * @param string $groupname * @return Entity\Group */ public function addUserGroup(Entity\User $user, $groupname) { $groupRecord = new Entity\Group(); $groupRecord->setName($groupname)->setOwner($user->getId()); $user->addGroup($groupRecord); $this->em->persist($user); $this->em->flush(); return $groupRecord; }
/** * {@inheritDoc} */ public function addGroup(\Secretary\Entity\Group $group) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'addGroup', array($group)); return parent::addGroup($group); }