示例#1
0
 /**
  * {@inheritdoc}
  */
 public function removeChild(RoleInterface $role)
 {
     if ($this->hasChild($role)) {
         $role->setParent(null);
         $this->children->removeElement($role);
     }
 }
示例#2
0
 /**
  * Remove the RoleInterface object from collection
  *
  * @param RoleInterface|string $role
  *
  * @throws \InvalidArgumentException
  */
 public function removeRole($role)
 {
     if ($role instanceof RoleInterface) {
         $roleObject = $role;
     } elseif (is_string($role)) {
         $roleObject = $this->getRole($role);
     } else {
         throw new \InvalidArgumentException('$role must be an instance of Symfony\\Component\\Security\\Core\\Role\\RoleInterface or a string');
     }
     if ($roleObject) {
         $this->roles->removeElement($roleObject);
     }
 }