/** * 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); } }
/** * 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; }
/** * 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; }