buildContentInfoDomainObject() public method

Builds a ContentInfo domain object from value object returned from persistence.
public buildContentInfoDomainObject ( eZ\Publish\SPI\Persistence\Content\ContentInfo $spiContentInfo ) : eZ\Publish\API\Repository\Values\Content\ContentInfo
$spiContentInfo eZ\Publish\SPI\Persistence\Content\ContentInfo
return eZ\Publish\API\Repository\Values\Content\ContentInfo
示例#1
0
 /**
  * Finds contentInfo objects for the given query.
  *
  * @see SearchServiceInterface::findContentInfo()
  *
  * @since 5.4.5
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if query is not valid
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Query $query
  * @param array $languageFilter - a map of filters for the returned fields.
  *        Currently supports: <code>array("languages" => array(<language1>,..), "useAlwaysAvailable" => bool)</code>
  *                            useAlwaysAvailable defaults to true to avoid exceptions on missing translations.
  * @param bool $filterOnUserPermissions if true (default) only the objects which is the user allowed to read are returned.
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Search\SearchResult
  */
 public function findContentInfo(Query $query, array $languageFilter = array(), $filterOnUserPermissions = true)
 {
     $result = $this->internalFindContentInfo($query, $languageFilter, $filterOnUserPermissions);
     foreach ($result->searchHits as $hit) {
         $hit->valueObject = $this->domainMapper->buildContentInfoDomainObject($hit->valueObject);
     }
     return $result;
 }
 /**
  * Loads a content info object.
  *
  * To load fields use loadContent
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the content with the given id does not exist
  *
  * @param mixed $id
  * @param bool $isRemoteId
  *
  * @return \eZ\Publish\API\Repository\Values\Content\ContentInfo
  */
 public function internalLoadContentInfo($id, $isRemoteId = false)
 {
     try {
         $method = $isRemoteId ? 'loadContentInfoByRemoteId' : 'loadContentInfo';
         return $this->domainMapper->buildContentInfoDomainObject($this->persistenceHandler->contentHandler()->{$method}($id));
     } catch (APINotFoundException $e) {
         throw new NotFoundException('Content', $id, $e);
     }
 }