Пример #1
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\Framework\StoreManagerInterface $storeManager
  * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory
  * @param \Magento\Eav\Model\Config $eavConfig
  * @param \Magento\CustomerImportExport\Model\Resource\Import\Customer\StorageFactory $storageFactory
  * @param \Magento\Customer\Model\Resource\Attribute\CollectionFactory $attrCollectionFactory
  * @param \Magento\Customer\Model\CustomerFactory $customerFactory
  * @param array $data
  */
 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\Framework\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\CustomerImportExport\Model\Resource\Import\Customer\StorageFactory $storageFactory, \Magento\Customer\Model\Resource\Attribute\CollectionFactory $attrCollectionFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, array $data = array())
 {
     $this->_resourceHelper = $resourceHelper;
     if (isset($data['attribute_collection'])) {
         $this->_attributeCollection = $data['attribute_collection'];
         unset($data['attribute_collection']);
     } else {
         $this->_attributeCollection = $attrCollectionFactory->create();
         $this->_attributeCollection->addSystemHiddenFilterWithPasswordHash();
         $data['attribute_collection'] = $this->_attributeCollection;
     }
     parent::__construct($coreData, $string, $scopeConfig, $importFactory, $resourceHelper, $resource, $storeManager, $collectionFactory, $eavConfig, $storageFactory, $data);
     $this->_specialAttributes[] = self::COLUMN_WEBSITE;
     $this->_specialAttributes[] = self::COLUMN_STORE;
     $this->_permanentAttributes[] = self::COLUMN_EMAIL;
     $this->_permanentAttributes[] = self::COLUMN_WEBSITE;
     $this->_indexValueAttributes[] = 'group_id';
     $this->addMessageTemplate(self::ERROR_DUPLICATE_EMAIL_SITE, __('E-mail is duplicated in import file'));
     $this->addMessageTemplate(self::ERROR_ROW_IS_ORPHAN, __('Orphan rows that will be skipped due default row errors'));
     $this->addMessageTemplate(self::ERROR_INVALID_STORE, __('Invalid value in Store column (store does not exists?)'));
     $this->addMessageTemplate(self::ERROR_EMAIL_SITE_NOT_FOUND, __('E-mail and website combination is not found'));
     $this->addMessageTemplate(self::ERROR_PASSWORD_LENGTH, __('Invalid password length'));
     $this->_initStores(true)->_initAttributes();
     $this->_customerModel = $customerFactory->create();
     /** @var $customerResource \Magento\Customer\Model\Resource\Customer */
     $customerResource = $this->_customerModel->getResource();
     $this->_entityTable = $customerResource->getEntityTable();
 }
Пример #2
0
 /**
  * @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\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory
  * @param \Magento\Eav\Model\Config $eavConfig
  * @param \Magento\CustomerImportExport\Model\Resource\Import\Customer\StorageFactory $storageFactory
  * @param \Magento\Customer\Model\AddressFactory $addressFactory
  * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionColFactory
  * @param \Magento\Customer\Model\CustomerFactory $customerFactory
  * @param \Magento\Customer\Model\Resource\Address\CollectionFactory $addressColFactory
  * @param \Magento\Customer\Model\Resource\Address\Attribute\CollectionFactory $attributesFactory
  * @param \Magento\Framework\Stdlib\DateTime $dateTime
  * @param array $data
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\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\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\CustomerImportExport\Model\Resource\Import\Customer\StorageFactory $storageFactory, \Magento\Customer\Model\AddressFactory $addressFactory, \Magento\Directory\Model\Resource\Region\CollectionFactory $regionColFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Customer\Model\Resource\Address\CollectionFactory $addressColFactory, \Magento\Customer\Model\Resource\Address\Attribute\CollectionFactory $attributesFactory, \Magento\Framework\Stdlib\DateTime $dateTime, array $data = [])
 {
     $this->_customerFactory = $customerFactory;
     $this->_addressFactory = $addressFactory;
     $this->_eavConfig = $eavConfig;
     $this->_resourceHelper = $resourceHelper;
     $this->dateTime = $dateTime;
     if (!isset($data['attribute_collection'])) {
         /** @var $attributeCollection \Magento\Customer\Model\Resource\Address\Attribute\Collection */
         $attributeCollection = $attributesFactory->create();
         $attributeCollection->addSystemHiddenFilter()->addExcludeHiddenFrontendFilter();
         $data['attribute_collection'] = $attributeCollection;
     }
     parent::__construct($string, $scopeConfig, $importFactory, $resourceHelper, $resource, $storeManager, $collectionFactory, $eavConfig, $storageFactory, $data);
     $this->_addressCollection = isset($data['address_collection']) ? $data['address_collection'] : $addressColFactory->create();
     $this->_entityTable = isset($data['entity_table']) ? $data['entity_table'] : $addressFactory->create()->getResource()->getEntityTable();
     $this->_regionCollection = isset($data['region_collection']) ? $data['region_collection'] : $regionColFactory->create();
     $this->addMessageTemplate(self::ERROR_ADDRESS_ID_IS_EMPTY, __('Customer address id column is not specified'));
     $this->addMessageTemplate(self::ERROR_ADDRESS_NOT_FOUND, __("Customer address for such customer doesn't exist"));
     $this->addMessageTemplate(self::ERROR_INVALID_REGION, __('Region is invalid'));
     $this->addMessageTemplate(self::ERROR_DUPLICATE_PK, __('Row with such email, website and address id combination was already found.'));
     $this->_initAttributes();
     $this->_initAddresses()->_initCountryRegions();
 }