Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DataCollection.php
Go to the documentation of this file.
1 <?php
8 
13 
15 {
19  private $config;
20 
24  private $indexerRegistry;
25 
31  public function __construct(
32  EntityFactoryInterface $entityFactory,
33  ConfigInterface $config,
34  IndexerRegistry $indexerRegistry
35  ) {
36  $this->config = $config;
37  $this->indexerRegistry = $indexerRegistry;
38  parent::__construct($entityFactory);
39  }
40 
46  public function loadData($printQuery = false, $logQuery = false)
47  {
48  if (!$this->isLoaded()) {
49  foreach (array_keys($this->config->getIndexers()) as $indexerId) {
50  $indexer = $this->indexerRegistry->get($indexerId);
51  $item = $this->getNewEmptyItem();
52  $data = [
53  'indexer_id' => $indexer->getId(),
54  'title' => $indexer->getTitle(),
55  'description' => $indexer->getDescription(),
56  'is_scheduled' => $indexer->isScheduled(),
57  'status' => $indexer->getStatus(),
58  'updated' => $indexer->getLatestUpdated(),
59  ];
60  $this->addItem($item->setData($data));
61  }
62  $this->_setIsLoaded(true);
63  }
64  return $this;
65  }
66 }
loadData($printQuery=false, $logQuery=false)
$config
Definition: fraud_order.php:17
__construct(EntityFactoryInterface $entityFactory, ConfigInterface $config, IndexerRegistry $indexerRegistry)
addItem(\Magento\Framework\DataObject $item)
Definition: Collection.php:399