예제 #1
0
 /**
  * Assign parent roles to this role.
  *
  * @param array<\TYPO3\Flow\Security\Policy\Role> $parentRoles
  * @return void
  */
 public function setParentRoles(array $parentRoles)
 {
     $this->parentRoles->clear();
     foreach ($parentRoles as $role) {
         $this->addParentRole($role);
     }
 }
 /**
  * Sets the roles for this account
  *
  * @param array|\Doctrine\Common\Collections\Collection $roles A Collection of TYPO3\Flow\Security\Policy\Role objects
  * @throws \InvalidArgumentException
  * @return void
  */
 public function setRoles($roles)
 {
     if ($roles instanceof Collection) {
         $this->roles = clone $roles;
     } elseif (is_array($roles)) {
         $this->roles->clear();
         foreach ($roles as $role) {
             $this->roles->add($role);
         }
     } else {
         throw new \InvalidArgumentException(sprintf('setRoles() expects an array or Doctrine Collection, %s given.', is_object($roles) ? get_class($roles) : gettype($roles)), 1366103284);
     }
 }