Exemplo n.º 1
0
 /**
  * @param \Magento\Framework\Stdlib\StringUtils $string
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  * @param \Magento\ImportExport\Model\ImportFactory $importFactory
  * @param \Magento\ImportExport\Model\ResourceModel\Helper $resourceHelper
  * @param \Magento\Framework\App\ResourceConnection $resource
  * @param ProcessingErrorAggregatorInterface $errorAggregator
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory
  * @param \Magento\Eav\Model\Config $eavConfig
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function __construct(\Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\App\ResourceConnection $resource, ProcessingErrorAggregatorInterface $errorAggregator, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\Eav\Model\Config $eavConfig, array $data = [])
 {
     parent::__construct($string, $scopeConfig, $importFactory, $resourceHelper, $resource, $errorAggregator, $data);
     $this->_storeManager = $storeManager;
     $this->_attributeCollection = isset($data['attribute_collection']) ? $data['attribute_collection'] : $collectionFactory->create(static::ATTRIBUTE_COLLECTION_NAME);
     if (isset($data['entity_type_id'])) {
         $this->_entityTypeId = $data['entity_type_id'];
     } else {
         $this->_entityTypeId = $eavConfig->getEntityType($this->getEntityTypeCode())->getEntityTypeId();
     }
 }
Exemplo n.º 2
0
 /**
  * @param \Magento\Core\Helper\Data $coreData
  * @param \Magento\Framework\Stdlib\String $string
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  * @param \Magento\ImportExport\Model\ImportFactory $importFactory
  * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper
  * @param \Magento\Framework\App\Resource $resource
  * @param \Magento\CustomerImportExport\Model\Resource\Import\CustomerComposite\DataFactory $dataFactory
  * @param \Magento\CustomerImportExport\Model\Import\CustomerFactory $customerFactory
  * @param \Magento\CustomerImportExport\Model\Import\AddressFactory $addressFactory
  * @param array $data
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Core\Helper\Data $coreData, \Magento\Framework\Stdlib\String $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, \Magento\Framework\App\Resource $resource, \Magento\CustomerImportExport\Model\Resource\Import\CustomerComposite\DataFactory $dataFactory, \Magento\CustomerImportExport\Model\Import\CustomerFactory $customerFactory, \Magento\CustomerImportExport\Model\Import\AddressFactory $addressFactory, array $data = array())
 {
     parent::__construct($coreData, $string, $scopeConfig, $importFactory, $resourceHelper, $resource, $data);
     $this->addMessageTemplate(self::ERROR_ROW_IS_ORPHAN, __('Orphan rows that will be skipped due default row errors'));
     $this->_availableBehaviors = array(\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND, \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE);
     // customer entity stuff
     if (isset($data['customer_data_source_model'])) {
         $this->_dataSourceModels['customer'] = $data['customer_data_source_model'];
     } else {
         $arguments = array('entity_type' => CustomerComposite::COMPONENT_ENTITY_CUSTOMER);
         $this->_dataSourceModels['customer'] = $dataFactory->create(array('arguments' => $arguments));
     }
     if (isset($data['customer_entity'])) {
         $this->_customerEntity = $data['customer_entity'];
     } else {
         $data['data_source_model'] = $this->_dataSourceModels['customer'];
         $this->_customerEntity = $customerFactory->create(array('data' => $data));
         unset($data['data_source_model']);
     }
     $this->_initCustomerAttributes();
     // address entity stuff
     if (isset($data['address_data_source_model'])) {
         $this->_dataSourceModels['address'] = $data['address_data_source_model'];
     } else {
         $arguments = array('entity_type' => CustomerComposite::COMPONENT_ENTITY_ADDRESS, 'customer_attributes' => $this->_customerAttributes);
         $this->_dataSourceModels['address'] = $dataFactory->create(array('arguments' => $arguments));
     }
     if (isset($data['address_entity'])) {
         $this->_addressEntity = $data['address_entity'];
     } else {
         $data['data_source_model'] = $this->_dataSourceModels['address'];
         $this->_addressEntity = $addressFactory->create(array('data' => $data));
         unset($data['data_source_model']);
     }
     $this->_initAddressAttributes();
     // next customer id
     if (isset($data['next_customer_id'])) {
         $this->_nextCustomerId = $data['next_customer_id'];
     } else {
         $this->_nextCustomerId = $resourceHelper->getNextAutoincrement($this->_customerEntity->getEntityTable());
     }
 }