public function getRole( $identifier )
    {
         /** @var \eZ\Publish\API\Repository\Repository $repository */
        $repository = $this->getRepository();
        $role = $repository->sudo(
            function() use( $repository, $identifier )
            {
                $role = null;
                $roleService = $repository->getRoleService();
                try
                {
                    // make sure role name starts with uppercase as this is what default setup provides
                    if ($identifier !== ucfirst($identifier)) {
                        @trigger_error(
                            "'{$identifier}' role name should start with uppercase letter",
                            E_USER_DEPRECATED
                        );
                    }
                    $role = $roleService->loadRoleByIdentifier(ucfirst($identifier));
                }
                catch ( ApiExceptions\NotFoundException $e )
                {
                    // Role not found, do nothing, returns null
                }

                return $role;
            }
        );

        return $role;
    }
public function getRole( $identifier )
    {
         /** @var \eZ\Publish\API\Repository\Repository $repository */
        $repository = $this->getRepository();
        $role = $repository->sudo(
            function() use( $repository, $identifier )
            {
                $role = null;
                $roleService = $repository->getRoleService();
                try
                {
                    // make sure role name starts with uppercase as this is what default setup provides
                    if ($identifier !== ucfirst($identifier)) {
                        @trigger_error(
                            "'{$identifier}' role name should start with uppercase letter",
                            E_USER_DEPRECATED
                        );
                    }
                    $role = $roleService->loadRoleByIdentifier(ucfirst($identifier));
                }
                catch ( ApiExceptions\NotFoundException $e )
                {
                    // Role not found, do nothing, returns null
                }

                return $role;
            }
        );

        return $role;
    }
public function getRole ( $ identifier ) { /** @var \eZ\Publish\API\Repository\Repository $repository */ $ repository = $ this -> getRepository ( ) ; $ role = $ repository -> sudo ( function ( ) use ( $ repository , $ identifier ) { $ role = null ; $ roleService = $ repository -> getRoleService ( ) ; try { // make sure role name starts with uppercase as this is what default setup provides if ( $ identifier !== ucfirst ( $ identifier ) ) { @ trigger_error ( "'{$identifier}' role name should start with uppercase letter" , E_USER_DEPRECATED ) ; } $ role = $ roleService -> loadRoleByIdentifier ( ucfirst ( $ identifier ) ) ; } catch ( ApiExceptions \ NotFoundException $ e ) { // Role not found, do nothing, returns null } return $ role ; } ) ; return $ role ; }
Fetches the role with identifier

@param string $identifier Role identifier

@return \eZ\Publish\API\Repository\Values\User\Role
Fetches the role with identifier