class SolrDocumentFactory in Search API Solr 4.x
Same name and namespace in other branches
- 8.3 src/SolrDocumentFactory.php \Drupal\search_api_solr\SolrDocumentFactory
- 8.2 src/SolrDocumentFactory.php \Drupal\search_api_solr\SolrDocumentFactory
Defines a class for a Solr Document factory.
Hierarchy
- class \Drupal\search_api_solr\SolrDocumentFactory implements SolrDocumentFactoryInterface
Expanded class hierarchy of SolrDocumentFactory
1 string reference to 'SolrDocumentFactory'
1 service uses SolrDocumentFactory
File
- src/
SolrDocumentFactory.php, line 11
Namespace
Drupal\search_api_solrView source
class SolrDocumentFactory implements SolrDocumentFactoryInterface {
/**
* Document name.
*
* @var string
*/
protected static $solrDocument = 'solr_document';
/**
* A typed data manager.
*
* @var \Drupal\Core\TypedData\TypedDataManagerInterface
*/
protected $typedDataManager;
/**
* Constructs a SolrDocumentFactory object.
*
* @param \Drupal\Core\TypedData\TypedDataManagerInterface $typedDataManager
* A typed data manager.
*/
public function __construct(TypedDataManagerInterface $typedDataManager) {
$this->typedDataManager = $typedDataManager;
}
/**
* {@inheritdoc}
*
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function create(ItemInterface $item) {
$plugin = $this->typedDataManager
->getDefinition(static::$solrDocument)['class'];
return $plugin::createFromItem($item);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SolrDocumentFactory:: |
protected static | property | Document name. | 1 |
SolrDocumentFactory:: |
protected | property | A typed data manager. | |
SolrDocumentFactory:: |
public | function |
Overrides SolrDocumentFactoryInterface:: |
|
SolrDocumentFactory:: |
public | function | Constructs a SolrDocumentFactory object. |