buildDomainRoleDraftObject() public method

Builds a RoleDraft domain object from value object returned by persistence Decorates Role.
public buildDomainRoleDraftObject ( eZ\Publish\SPI\Persistence\User\Role $spiRole ) : eZ\Publish\API\Repository\Values\User\RoleDraft
$spiRole eZ\Publish\SPI\Persistence\User\Role
return eZ\Publish\API\Repository\Values\User\RoleDraft
Example #1
0
 /**
  * Loads a RoleDraft by the ID of the role it was created from.
  *
  * @param mixed $roleId ID of the role the draft was created from.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a RoleDraft with the given id was not found
  *
  * @return \eZ\Publish\API\Repository\Values\User\RoleDraft
  */
 public function loadRoleDraftByRoleId($roleId)
 {
     if ($this->repository->hasAccess('role', 'read') !== true) {
         throw new UnauthorizedException('role', 'read');
     }
     $spiRole = $this->userHandler->loadRoleDraftByRoleId($roleId);
     return $this->roleDomainMapper->buildDomainRoleDraftObject($spiRole);
 }