Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
IndexerRegistry Class Reference

Public Member Functions

 __construct (\Magento\Framework\ObjectManagerInterface $objectManager)
 
 get ($indexerId)
 

Protected Attributes

 $objectManager
 
 $indexers = []
 

Detailed Description

@api Retrieve indexer by id, for example when indexer need to be invalidated

Since
100.0.2

Definition at line 12 of file IndexerRegistry.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\ObjectManagerInterface  $objectManager)
Parameters
\Magento\Framework\ObjectManagerInterface$objectManager

Definition at line 27 of file IndexerRegistry.php.

28  {
29  $this->objectManager = $objectManager;
30  }

Member Function Documentation

◆ get()

get (   $indexerId)

Retrieve indexer instance by id

Parameters
string$indexerId
Returns
IndexerInterface

Definition at line 38 of file IndexerRegistry.php.

39  {
40  if (!isset($this->indexers[$indexerId])) {
41  $this->indexers[$indexerId] = $this->objectManager->create(
42  \Magento\Framework\Indexer\IndexerInterface::class
43  )->load($indexerId);
44  }
45  return $this->indexers[$indexerId];
46  }

Field Documentation

◆ $indexers

$indexers = []
protected

Definition at line 22 of file IndexerRegistry.php.

◆ $objectManager

$objectManager
protected

Definition at line 17 of file IndexerRegistry.php.


The documentation for this class was generated from the following file: