Newscoop\Entity\User::getGroups PHP Method

getGroups() public method

Get groups
public getGroups ( ) : array
return array of Newscoop\Entity\User\Group
    public function getGroups()
    {
        return $this->groups;
    }

Usage Example

Beispiel #1
0
 /**
  * Test if user is blogger
  *
  * @param Newscoop\Entity\User $user
  * @return bool
  */
 public function isBlogger(User $user)
 {
     foreach ($user->getGroups() as $group) {
         if ($this->config['role'] == $group->getId()) {
             if (count($user->getGroups()) == 1) {
                 return true;
             }
         }
     }
     return false;
 }
All Usage Examples Of Newscoop\Entity\User::getGroups