Beispiel #1
0
 /**
  * Initialize source entities and collections
  *
  * @param array $data
  * @return $this
  * @throws \Magento\Framework\Model\Exception
  */
 protected function _initSourceEntities(array $data)
 {
     if (isset($data['data_source_model'])) {
         $this->_dataSourceModel = $data['data_source_model'];
     }
     if (isset($data['product_model'])) {
         $this->_productModel = $data['product_model'];
     } else {
         $this->_productModel = $this->_productFactory->create();
     }
     if (isset($data['option_collection'])) {
         $this->_optionCollection = $data['option_collection'];
     } else {
         $this->_optionCollection = $this->_optionColFactory->create();
     }
     if (isset($data['product_entity'])) {
         $this->_productEntity = $data['product_entity'];
     } else {
         throw new \Magento\Framework\Model\Exception(__('Option entity must have a parent product entity.'));
     }
     if (isset($data['collection_by_pages_iterator'])) {
         $this->_byPagesIterator = $data['collection_by_pages_iterator'];
     } else {
         $this->_byPagesIterator = $this->_colIteratorFactory->create();
     }
     if (isset($data['page_size'])) {
         $this->_pageSize = $data['page_size'];
     } else {
         $this->_pageSize = self::XML_PATH_PAGE_SIZE ? (int) $this->_scopeConfig->getValue(self::XML_PATH_PAGE_SIZE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE) : 0;
     }
     return $this;
 }
Beispiel #2
0
 /**
  * @param \Magento\Customer\Model\Resource\Customer\CollectionFactory $collectionFactory
  * @param \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $colIteratorFactory
  * @param array $data
  */
 public function __construct(\Magento\Customer\Model\Resource\Customer\CollectionFactory $collectionFactory, \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $colIteratorFactory, array $data = [])
 {
     $this->_customerCollection = isset($data['customer_collection']) ? $data['customer_collection'] : $collectionFactory->create();
     $this->_pageSize = isset($data['page_size']) ? $data['page_size'] : 0;
     $this->_byPagesIterator = isset($data['collection_by_pages_iterator']) ? $data['collection_by_pages_iterator'] : $colIteratorFactory->create();
 }
Beispiel #3
0
 /**
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory
  * @param \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $resourceColFactory
  * @param array $data
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $resourceColFactory, array $data = [])
 {
     $this->_scopeConfig = $scopeConfig;
     $this->_storeManager = $storeManager;
     $this->_attributeCollection = isset($data['attribute_collection']) ? $data['attribute_collection'] : $collectionFactory->create(static::ATTRIBUTE_COLLECTION_NAME);
     $this->_pageSize = isset($data['page_size']) ? $data['page_size'] : (static::XML_PATH_PAGE_SIZE ? (int) $this->_scopeConfig->getValue(static::XML_PATH_PAGE_SIZE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE) : 0);
     $this->_byPagesIterator = isset($data['collection_by_pages_iterator']) ? $data['collection_by_pages_iterator'] : $resourceColFactory->create();
 }