src/Component/AuthManager.php
public function addChildRole(Role $parentRole, Role $childRole)
    {
        $roleHierarchy = new RoleHierarchy();

        $roleHierarchy->setParentRole($parentRole);
        $roleHierarchy->setChildRole($childRole);

        $this->checkForCyclicHierarchy($childRole->getId(), $parentRole->getId());

        try {
            $this->saveEntity($roleHierarchy);
        }  catch (UniqueConstraintViolationException $e) {
            throw new NotUniqueException('Child role ' . $childRole->getName() . ' is already has parent role ' . $parentRole->getName());
        }
    }
public function addChildRole(Role $parentRole, Role $childRole)
    {
        $roleHierarchy = new RoleHierarchy();

        $roleHierarchy->setParentRole($parentRole);
        $roleHierarchy->setChildRole($childRole);

        $this->checkForCyclicHierarchy($childRole->getId(), $parentRole->getId());

        try {
            $this->saveEntity($roleHierarchy);
        }  catch (UniqueConstraintViolationException $e) {
            throw new NotUniqueException('Child role ' . $childRole->getName() . ' is already has parent role ' . $parentRole->getName());
        }
    }
public function addChildRole ( Role $ parentRole , Role $ childRole ) { $ roleHierarchy = new RoleHierarchy ( ) ; $ roleHierarchy -> setParentRole ( $ parentRole ) ; $ roleHierarchy -> setChildRole ( $ childRole ) ; $ this -> checkForCyclicHierarchy ( $ childRole -> getId ( ) , $ parentRole -> getId ( ) ) ; try { $ this -> saveEntity ( $ roleHierarchy ) ; } catch ( UniqueConstraintViolationException $ e ) { throw new NotUniqueException ( 'Child role ' . $ childRole -> getName ( ) . ' is already has parent role ' . $ parentRole -> getName ( ) ) ; } }
Add child role to role
@param Role $parentRole
@param Role $childRole
@throws CyclicException
@throws DatabaseException
@throws NotUniqueException
@throws \Doctrine\ORM\Query\QueryException
Add child role to role