loadRole() abstract public method

Loads a specified role by $roleId.
abstract public loadRole ( mixed $roleId, integer $status = Role::STATUS_DEFINED ) : array
$roleId mixed
$status integer One of Role::STATUS_DEFINED|Role::STATUS_DRAFT
return array
 /**
  * Loads a specified role by $roleId.
  *
  * @param mixed $roleId
  * @param int $status One of Role::STATUS_DEFINED|Role::STATUS_DRAFT
  *
  * @return array
  */
 public function loadRole($roleId, $status = Role::STATUS_DEFINED)
 {
     try {
         return $this->innerGateway->loadRole($roleId, $status);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }
 /**
  * Loads a specified role by $roleId
  *
  * @param mixed $roleId
  *
  * @return array
  */
 public function loadRole($roleId)
 {
     try {
         return $this->innerGateway->loadRole($roleId);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }
Example #3
0
 /**
  * Loads a specified role (draft) by $roleId and $status.
  *
  * @param mixed $roleId
  * @param int $status One of Role::STATUS_DEFINED|Role::STATUS_DRAFT
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If role with given status does not exist
  *
  * @return \eZ\Publish\SPI\Persistence\User\Role
  */
 public function loadRole($roleId, $status = Role::STATUS_DEFINED)
 {
     $data = $this->roleGateway->loadRole($roleId, $status);
     if (empty($data)) {
         throw new RoleNotFound($roleId, $status);
     }
     $role = $this->mapper->mapRole($data);
     foreach ($role->policies as $policy) {
         $this->limitationConverter->toSPI($policy);
     }
     return $role;
 }
Example #4
0
 /**
  * Loads a specified role by $roleId.
  *
  * @param mixed $roleId
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If role is not found
  *
  * @return \eZ\Publish\SPI\Persistence\User\Role
  */
 public function loadRole($roleId)
 {
     $data = $this->roleGateway->loadRole($roleId);
     if (empty($data)) {
         throw new NotFound('role', $roleId);
     }
     $role = $this->mapper->mapRole($data);
     foreach ($role->policies as $policy) {
         $this->limitationConverter->toSPI($policy);
     }
     return $role;
 }