FOS\UserBundle\Model\User::addGroup PHP Method

addGroup() public method

Add a group to the user groups
public addGroup ( FOS\UserBundle\Model\GroupInterface $group ) : null
$group FOS\UserBundle\Model\GroupInterface
return null
    public function addGroup(GroupInterface $group)
    {
        if (!$this->getGroups()->contains($group)) {
            $this->getGroups()->add($group);
        }
    }

Usage Example

Example #1
0
 public function addGroup(GroupInterface $groups)
 {
     parent::addGroup($groups);
     $this->groups[] = $groups;
     return $this;
 }
All Usage Examples Of FOS\UserBundle\Model\User::addGroup