Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Store.php
Go to the documentation of this file.
1 <?php
7 
13 {
17  protected $_options;
18 
22  protected $_storesFactory;
23 
27  public function __construct(\Magento\Store\Model\ResourceModel\Store\CollectionFactory $storesFactory)
28  {
29  $this->_storesFactory = $storesFactory;
30  }
31 
35  public function toOptionArray()
36  {
37  if (!$this->_options) {
39  $stores = $this->_storesFactory->create();
40  $this->_options = $stores->load()->toOptionArray();
41  }
42  return $this->_options;
43  }
44 }
__construct(\Magento\Store\Model\ResourceModel\Store\CollectionFactory $storesFactory)
Definition: Store.php:27