To load fields use loadContent
public loadContentInfo ( integer $contentId ) : eZ\Publish\API\Repository\Values\Content\ContentInfo | ||
$contentId | integer | |
return | eZ\Publish\API\Repository\Values\Content\ContentInfo |
/** * 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; }