protected function isRoleReached(Role $childRole, Role $parentRole)
    {
        $reachableRoles = $this->roleHierarchy
                ->getReachableRoles([$parentRole]);
        
        return in_array($childRole, $reachableRoles);
    }
protected function isRoleReached(Role $childRole, Role $parentRole)
    {
        $reachableRoles = $this->roleHierarchy
                ->getReachableRoles([$parentRole]);
        
        return in_array($childRole, $reachableRoles);
    }
protected function isRoleReached ( Role $ childRole , Role $ parentRole ) { $ reachableRoles = $ this -> roleHierarchy -> getReachableRoles ( [ $ parentRole ] ) ; return in_array ( $ childRole , $ reachableRoles ) ; }
Test if a parent role may give access to a given child role

@param Role $childRole The role we want to test if he is reachable
@param Role $parentRole The role which should give access to $childRole
@return boolean true if the child role is granted by parent role
Test if a parent role may give access to a given child role