eZ\Publish\Core\Repository\ContentService::loadContentInfo PHP Метод

loadContentInfo() публичный Метод

To load fields use loadContent
public loadContentInfo ( integer $contentId ) : eZ\Publish\API\Repository\Values\Content\ContentInfo
$contentId integer
Результат eZ\Publish\API\Repository\Values\Content\ContentInfo
    public function loadContentInfo($contentId)
    {
        $contentInfo = $this->internalLoadContentInfo($contentId);
        if (!$this->repository->canUser('content', 'read', $contentInfo)) {
            throw new UnauthorizedException('content', 'read', array('contentId' => $contentId));
        }
        return $contentInfo;
    }

Usage Example

 /**
  * Returns author of the content.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Content $contentValue
  * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType
  *
  * @return string
  */
 private function getAuthor(Content $contentValue, ContentType $contentType)
 {
     $author = $contentValue->getFieldValue($this->value->getConfiguredFieldIdentifier('author', $contentType));
     if (null === $author) {
         $ownerId = empty($contentValue->contentInfo->ownerId) ? $this->defaultAuthorId : $contentValue->contentInfo->ownerId;
         $userContentInfo = $this->contentService->loadContentInfo($ownerId);
         $author = $userContentInfo->name;
     }
     return (string) $author;
 }