Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractProcessor.php
Go to the documentation of this file.
1 <?php
10 
11 abstract class AbstractProcessor
12 {
16  const INDEXER_ID = '';
17 
21  protected $indexerRegistry;
22 
26  public function __construct(
27  \Magento\Framework\Indexer\IndexerRegistry $indexerRegistry
28  ) {
29  $this->indexerRegistry = $indexerRegistry;
30  }
31 
37  public function getIndexer()
38  {
39  return $this->indexerRegistry->get(static::INDEXER_ID);
40  }
41 
49  public function reindexRow($id, $forceReindex = false)
50  {
51  if (!$forceReindex && $this->isIndexerScheduled()) {
52  return;
53  }
54  $this->getIndexer()->reindexRow($id);
55  }
56 
64  public function reindexList($ids, $forceReindex = false)
65  {
66  if (!$forceReindex && $this->isIndexerScheduled()) {
67  return;
68  }
69  $this->getIndexer()->reindexList($ids);
70  }
71 
77  public function reindexAll()
78  {
79  $this->getIndexer()->reindexAll();
80  }
81 
87  public function markIndexerAsInvalid()
88  {
89  $this->getIndexer()->invalidate();
90  }
91 
97  public function getIndexerId()
98  {
99  return static::INDEXER_ID;
100  }
101 
107  public function isIndexerScheduled()
108  {
109  return $this->getIndexer()->isScheduled();
110  }
111 }
$id
Definition: fieldset.phtml:14
__construct(\Magento\Framework\Indexer\IndexerRegistry $indexerRegistry)