public function loadVersionInfoById($contentId, $versionNo = null)
    {
        // @todo SPI should also support null to avoid concurrency issues
        if ($versionNo === null) {
            $versionNo = $this->loadContentInfo($contentId)->currentVersionNo;
        }

        try {
            $spiVersionInfo = $this->persistenceHandler->contentHandler()->loadVersionInfo(
                $contentId,
                $versionNo
            );
        } catch (APINotFoundException $e) {
            throw new NotFoundException(
                'VersionInfo',
                array(
                    'contentId' => $contentId,
                    'versionNo' => $versionNo,
                ),
                $e
            );
        }

        $versionInfo = $this->domainMapper->buildVersionInfoDomainObject($spiVersionInfo);

        if ($versionInfo->isPublished()) {
            $function = 'read';
        } else {
            $function = 'versionread';
        }

        if (!$this->repository->canUser('content', $function, $versionInfo)) {
            throw new UnauthorizedException('content', $function, array('contentId' => $contentId));
        }

        return $versionInfo;
    }
public function loadVersionInfoById($contentId, $versionNo = null)
    {
        // @todo SPI should also support null to avoid concurrency issues
        if ($versionNo === null) {
            $versionNo = $this->loadContentInfo($contentId)->currentVersionNo;
        }

        try {
            $spiVersionInfo = $this->persistenceHandler->contentHandler()->loadVersionInfo(
                $contentId,
                $versionNo
            );
        } catch (APINotFoundException $e) {
            throw new NotFoundException(
                'VersionInfo',
                array(
                    'contentId' => $contentId,
                    'versionNo' => $versionNo,
                ),
                $e
            );
        }

        $versionInfo = $this->domainMapper->buildVersionInfoDomainObject($spiVersionInfo);

        if ($versionInfo->isPublished()) {
            $function = 'read';
        } else {
            $function = 'versionread';
        }

        if (!$this->repository->canUser('content', $function, $versionInfo)) {
            throw new UnauthorizedException('content', $function, array('contentId' => $contentId));
        }

        return $versionInfo;
    }
public function loadVersionInfoById ( $ contentId , $ versionNo = null ) { // @todo SPI should also support null to avoid concurrency issues if ( $ versionNo === null ) { $ versionNo = $ this -> loadContentInfo ( $ contentId ) -> currentVersionNo ; } try { $ spiVersionInfo = $ this -> persistenceHandler -> contentHandler ( ) -> loadVersionInfo ( $ contentId , $ versionNo ) ; } catch ( APINotFoundException $ e ) { throw new NotFoundException ( 'VersionInfo' , array ( 'contentId' => $ contentId , 'versionNo' => $ versionNo , ) , $ e ) ; } $ versionInfo = $ this -> domainMapper -> buildVersionInfoDomainObject ( $ spiVersionInfo ) ; if ( $ versionInfo -> isPublished ( ) ) { $ function = 'read' ; } else { $ function = 'versionread' ; } if ( ! $ this -> repository -> canUser ( 'content' , $ function , $ versionInfo ) ) { throw new UnauthorizedException ( 'content' , $ function , array ( 'contentId' => $ contentId ) ) ; } return $ versionInfo ; }
Loads a version info of the given content object id.

If no version number is given, the method returns the current version

@throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the version with the given number does not exist
@throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version

@param mixed $contentId
@param int $versionNo the version number. If not given the current version is returned.

@return \eZ\Publish\API\Repository\Values\Content\VersionInfo
Loads a version info of the given content object id .