Copied!

DocumentMapper

DocumentMapper.php : 18

Mapper maps Content and Location objects to a Document objects, representing a document in Solr index storage.

Note that custom implementations might need to be accompanied by custom schema.

Constants

publicDOCUMENT_TYPE_IDENTIFIER_CONTENT

DocumentMapper.php : 25

Identifier of Content documents.

public string DOCUMENT_TYPE_IDENTIFIER_CONTENT = 'content'

publicDOCUMENT_TYPE_IDENTIFIER_LOCATION

DocumentMapper.php : 32

Identifier of Location documents.

public string DOCUMENT_TYPE_IDENTIFIER_LOCATION = 'location'

Methods

publicgenerateContentDocumentId()

DocumentMapper.php : 57

Generates the Solr backend document ID for Content object.

public generateContentDocumentId(int|string $contentId[, string $languageCode = null ]) : string

If $language code is not provided, the method will return prefix of the IDs of all Content's documents (there will be one document per translation). The above is useful when targeting all Content's documents, without the knowledge of it's translations.

Parameters

Name Type Default value Description
$contentId int|string - -
$languageCode string null -

Return values

string

publicgenerateLocationDocumentId()

DocumentMapper.php : 72

Generates the Solr backend document ID for Location object.

public generateLocationDocumentId(int|string $locationId[, string $languageCode = null ]) : string

If $language code is not provided, the method will return prefix of the IDs of all Location's documents (there will be one document per translation). The above is useful when targeting all Location's documents, without the knowledge of it's Content's translations.

Parameters

Name Type Default value Description
$locationId int|string - -
$languageCode string null -

Return values

string

publicmapContentBlock()

DocumentMapper.php : 42

Maps given Content and it's Locations to a collection of nested Documents, one per translation.

public mapContentBlock(Content $content) : array<string|int, Document>

Each Content Document contains nested Documents representing it's Locations.

Parameters

Name Type Default value Description
$content Content - -

Return values

array<string|int, Document>