You are here

public static function SolrDocumentDefinition::create in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 src/TypedData/SolrDocumentDefinition.php \Drupal\search_api_solr\TypedData\SolrDocumentDefinition::create()
  2. 4.x src/TypedData/SolrDocumentDefinition.php \Drupal\search_api_solr\TypedData\SolrDocumentDefinition::create()

Creates a new Solr document definition.

Parameters

string $server_id: The Search API server the Solr document definition belongs to.

Return value

static

Overrides DataDefinition::create

2 calls to SolrDocumentDefinition::create()
SolrDocument::createFromItem in src/Plugin/DataType/SolrDocument.php
Creates an instance wrapping the given Item.
SolrDocumentDefinition::createFromDataType in src/TypedData/SolrDocumentDefinition.php
Creates a new data definition object.

File

src/TypedData/SolrDocumentDefinition.php, line 27

Class

SolrDocumentDefinition
A typed data definition class for describing Solr documents.

Namespace

Drupal\search_api_solr\TypedData

Code

public static function create($server_id) {
  $definition['type'] = 'solr_document:' . $server_id;
  $document_definition = new static($definition);
  $document_definition
    ->setServerId($server_id);
  return $document_definition;
}