예제 #1
0
 /**
  * @param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory
  * @param \Psr\Log\LoggerInterface $logger
  * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
  * @param \Magento\Framework\Event\ManagerInterface $eventManager
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param mixed|null $mainTable
  * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $eventPrefix
  * @param mixed $eventObject
  * @param mixed $resourceModel
  * @param string $model
  * @param null $connection
  * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb|null $resource
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Store\Model\StoreManagerInterface $storeManager, $mainTable, $eventPrefix, $eventObject, $resourceModel, $model = 'Magento\\Framework\\View\\Element\\UiComponent\\DataProvider\\Document', $connection = null, \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null)
 {
     parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $storeManager, $connection, $resource);
     $this->_eventPrefix = $eventPrefix;
     $this->_eventObject = $eventObject;
     $this->_init($model, $resourceModel);
     $this->setMainTable($mainTable);
 }
예제 #2
0
 /**
  * Get data
  *
  * @return array
  */
 public function getData()
 {
     if (isset($this->loadedData)) {
         return $this->loadedData;
     }
     $items = $this->collection->getItems();
     /** @var \Fastgento\Storelocator\Model\Location $location */
     foreach ($items as $location) {
         $locationData = $location->getData();
         if (isset($locationData['image'])) {
             unset($locationData['image']);
             $locationData['image'][0]['name'] = $location->getData('image');
             $locationData['image'][0]['url'] = $location->getImageUrl();
         }
         $this->loadedData[$location->getId()] = $locationData;
     }
     return $this->loadedData;
 }