Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Collection.php
Go to the documentation of this file.
1 <?php
7 
9 
11 {
17  protected $_itemObjectClass = IndexerInterface::class;
18 
24  protected $_items = [];
25 
29  protected $config;
30 
34  protected $statesFactory;
35 
41  public function __construct(
42  \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory,
44  \Magento\Indexer\Model\ResourceModel\Indexer\State\CollectionFactory $statesFactory
45  ) {
46  $this->config = $config;
47  $this->statesFactory = $statesFactory;
48  parent::__construct($entityFactory);
49  }
50 
60  public function loadData($printQuery = false, $logQuery = false)
61  {
62  if (!$this->isLoaded()) {
63  $states = $this->statesFactory->create();
64  foreach (array_keys($this->config->getIndexers()) as $indexerId) {
66  $indexer = $this->getNewEmptyItem();
67  $indexer->load($indexerId);
68  foreach ($states->getItems() as $state) {
70  if ($state->getIndexerId() == $indexerId) {
71  $indexer->setState($state);
72  break;
73  }
74  }
75  $this->_addItem($indexer);
76  }
77  $this->_setIsLoaded(true);
78  }
79  return $this;
80  }
81 
85  public function getAllIds()
86  {
87  $ids = [];
88  foreach ($this->getItems() as $item) {
89  $ids[] = $item->getId();
90  }
91  return $ids;
92  }
93 
98  public function getItems()
99  {
100  return parent::getItems();
101  }
102 
108  public function getColumnValues($colName)
109  {
110  return [];
111  }
112 
118  public function getItemsByColumnValue($column, $value)
119  {
120  return [];
121  }
122 
128  public function getItemByColumnValue($column, $value)
129  {
130  return null;
131  }
132 
138  public function setDataToAll($key, $value = null)
139  {
140  return $this;
141  }
142 
149  {
150  return $this;
151  }
152 
157  public function toXml()
158  {
159  return '';
160  }
161 
167  public function toArray($arrRequiredFields = [])
168  {
169  return [];
170  }
171 
176  public function toOptionArray()
177  {
178  return [];
179  }
180 
185  public function toOptionHash()
186  {
187  return [];
188  }
189 
195  protected function _toOptionArray($valueField = 'id', $labelField = 'name', $additional = [])
196  {
197  return [];
198  }
199 
205  protected function _toOptionHash($valueField = 'id', $labelField = 'name')
206  {
207  return [];
208  }
209 }
_toOptionArray($valueField='id', $labelField='name', $additional=[])
Definition: Collection.php:195
loadData($printQuery=false, $logQuery=false)
Definition: Collection.php:675
_toOptionHash($valueField='id', $labelField='name')
Definition: Collection.php:205
__construct(\Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory, \Magento\Framework\Indexer\ConfigInterface $config, \Magento\Indexer\Model\ResourceModel\Indexer\State\CollectionFactory $statesFactory)
Definition: Collection.php:41
$value
Definition: gender.phtml:16
if($currentSelectedMethod==$_code) $className
Definition: form.phtml:31