loadRoleByIdentifier() abstract public method

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