getChildren() public method

Get children.
public getChildren ( ) : Doctrine\Common\Collections\Collection
return Doctrine\Common\Collections\Collection
Exemplo n.º 1
0
 /**
  * Checks if the given group has the permission to execute the desired task.
  *
  * @param SecurityCondition $object
  * @param int               $attribute
  * @param Group             $group
  * @param array             $locales
  *
  * @return bool
  */
 public function checkUserGroup($object, $attribute, Group $group, $locales)
 {
     // check if the group contains the permission
     foreach ($group->getRoles() as $role) {
         /** @var RoleInterface $role */
         if ($this->checkPermissions($object, $attribute, $role->getPermissions(), $locales)) {
             return true;
         }
     }
     // check if one of the child group contains the permission
     $children = $group->getChildren();
     if (!empty($children)) {
         foreach ($children as $child) {
             if ($this->checkUserGroup($object, $attribute, $child, $locales)) {
                 return true;
             }
         }
     }
     return false;
 }