eZ\Publish\Core\Search\Legacy\Content\Mapper\FullTextMapper::mapContent PHP Method

mapContent() public method

Map given Content to a FullTextValue.
public mapContent ( eZ\Publish\SPI\Persistence\Content $content ) : FullTextData
$content eZ\Publish\SPI\Persistence\Content
return eZ\Publish\Core\Search\Legacy\Content\FullTextData
    public function mapContent(Content $content)
    {
        return new FullTextData(['id' => $content->versionInfo->contentInfo->id, 'contentTypeId' => $content->versionInfo->contentInfo->contentTypeId, 'sectionId' => $content->versionInfo->contentInfo->sectionId, 'published' => $content->versionInfo->contentInfo->publicationDate, 'values' => $this->getFullTextValues($content)]);
    }

Usage Example

Example #1
0
 /**
  * Bulk index list of content objects.
  *
  * @param \eZ\Publish\SPI\Persistence\Content[] $contentList
  * @param callable $errorCallback (Content $content, NotFoundException $e)
  */
 public function bulkIndex(array $contentList, callable $errorCallback)
 {
     $fullTextBulkData = [];
     foreach ($contentList as $content) {
         try {
             $fullTextBulkData[] = $this->mapper->mapContent($content);
         } catch (NotFoundException $e) {
             $errorCallback($content, $e);
         }
     }
     $this->indexerGateway->bulkIndex($fullTextBulkData);
 }