Role/RoleHierarchy.php
private function findRecords(array $reachableRoles, array $roles)
    {
        $recordRoles = [];
        $om = ManagerUtils::getManager($this->registry, $this->roleClassname);
        $repo = $om->getRepository($this->roleClassname);

        $filters = SqlFilterUtil::findFilters($om, [], true);
        SqlFilterUtil::disableFilters($om, $filters);

        if (\count($roles) > 0) {
            $recordRoles = $repo->findBy(['name' => $this->cleanRoleNames($roles)]);
        }

        $loopReachableRoles = [$reachableRoles];

        /** @var RoleHierarchicalInterface $eRole */
        foreach ($recordRoles as $eRole) {
            $suffix = $this->buildRoleSuffix($roles[$eRole->getName()] ?? null);
            $subRoles = RoleUtil::formatNames($eRole->getChildren()->toArray());
            $loopReachableRoles[] = $this->doGetReachableRoles($subRoles, $suffix);
        }

        SqlFilterUtil::enableFilters($om, $filters);

        return array_merge(...$loopReachableRoles);
    }
private function findRecords(array $reachableRoles, array $roles)
    {
        $recordRoles = [];
        $om = ManagerUtils::getManager($this->registry, $this->roleClassname);
        $repo = $om->getRepository($this->roleClassname);

        $filters = SqlFilterUtil::findFilters($om, [], true);
        SqlFilterUtil::disableFilters($om, $filters);

        if (\count($roles) > 0) {
            $recordRoles = $repo->findBy(['name' => $this->cleanRoleNames($roles)]);
        }

        $loopReachableRoles = [$reachableRoles];

        /** @var RoleHierarchicalInterface $eRole */
        foreach ($recordRoles as $eRole) {
            $suffix = $this->buildRoleSuffix($roles[$eRole->getName()] ?? null);
            $subRoles = RoleUtil::formatNames($eRole->getChildren()->toArray());
            $loopReachableRoles[] = $this->doGetReachableRoles($subRoles, $suffix);
        }

        SqlFilterUtil::enableFilters($om, $filters);

        return array_merge(...$loopReachableRoles);
    }
private function findRecords ( array $ reachableRoles , array $ roles ) { $ recordRoles = [ ] ; $ om = ManagerUtils :: getManager ( $ this -> registry , $ this -> roleClassname ) ; $ repo = $ om -> getRepository ( $ this -> roleClassname ) ; $ filters = SqlFilterUtil :: findFilters ( $ om , [ ] , true ) ; SqlFilterUtil :: disableFilters ( $ om , $ filters ) ; if ( \ count ( $ roles ) > 0 ) { $ recordRoles = $ repo -> findBy ( [ 'name' => $ this -> cleanRoleNames ( $ roles ) ] ) ; } $ loopReachableRoles = [ $ reachableRoles ] ; /** @var RoleHierarchicalInterface $eRole */ foreach ( $ recordRoles as $ eRole ) { $ suffix = $ this -> buildRoleSuffix ( $ roles [ $ eRole -> getName ( ) ] ?? null ) ; $ subRoles = RoleUtil :: formatNames ( $ eRole -> getChildren ( ) -> toArray ( ) ) ; $ loopReachableRoles [ ] = $ this -> doGetReachableRoles ( $ subRoles , $ suffix ) ; } SqlFilterUtil :: enableFilters ( $ om , $ filters ) ; return array_merge ( ... $ loopReachableRoles ) ; }
Find the roles in database.

@param string[] $reachableRoles The reachable roles
@param string[] $roles          The role names

@throws

@return string[]
Find the roles in database .