예제 #1
0
 /**
  * Retrieve model behavior
  *
  * @return string
  */
 public function getBehavior()
 {
     if (is_null($this->_behavior)) {
         $this->_behavior = $this->_importFactory->create()->getDataSourceModel()->getBehavior();
     }
     return $this->_behavior;
 }
예제 #2
0
 protected function setUp()
 {
     $this->link = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\Link', [], [], '', false);
     $this->connection = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->resource = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->resource->expects($this->once())->method('getConnection')->will($this->returnValue($this->connection));
     $this->import = $this->getMock('Magento\\ImportExport\\Model\\Import', [], [], '', false);
     $this->importFactory = $this->getMock('Magento\\ImportExport\\Model\\ImportFactory', ['create'], [], '', false);
     $this->importFactory->expects($this->any())->method('create')->will($this->returnValue($this->import));
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->links = $this->objectManagerHelper->getObject('Magento\\GroupedImportExport\\Model\\Import\\Product\\Type\\Grouped\\Links', ['productLink' => $this->link, 'resource' => $this->resource, 'importFactory' => $this->importFactory]);
 }
예제 #3
0
 /**
  * Retrieve model behavior
  *
  * @return string
  */
 protected function getBehavior()
 {
     if ($this->behavior === null) {
         $this->behavior = $this->importFactory->create()->getDataSourceModel()->getBehavior();
     }
     return $this->behavior;
 }
예제 #4
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 array $data
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 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, array $data = [])
 {
     $this->_scopeConfig = $scopeConfig;
     $this->_dataSourceModel = isset($data['data_source_model']) ? $data['data_source_model'] : $importFactory->create()->getDataSourceModel();
     $this->_connection = isset($data['connection']) ? $data['connection'] : $resource->getConnection('write');
     $this->string = $string;
     $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->_maxDataSize = isset($data['max_data_size']) ? $data['max_data_size'] : $resourceHelper->getMaxDataSize();
     $this->_bunchSize = isset($data['bunch_size']) ? $data['bunch_size'] : (static::XML_PATH_BUNCH_SIZE ? (int) $this->_scopeConfig->getValue(static::XML_PATH_BUNCH_SIZE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE) : 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 array $data
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 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, ResourceConnection $resource, ProcessingErrorAggregatorInterface $errorAggregator, array $data = [])
 {
     $this->_scopeConfig = $scopeConfig;
     $this->_dataSourceModel = isset($data['data_source_model']) ? $data['data_source_model'] : $importFactory->create()->getDataSourceModel();
     $this->_connection = isset($data['connection']) ? $data['connection'] : $resource->getConnection();
     $this->string = $string;
     $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->_maxDataSize = isset($data['max_data_size']) ? $data['max_data_size'] : $resourceHelper->getMaxDataSize();
     $this->_bunchSize = isset($data['bunch_size']) ? $data['bunch_size'] : (static::XML_PATH_BUNCH_SIZE ? (int) $this->_scopeConfig->getValue(static::XML_PATH_BUNCH_SIZE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE) : 0);
     $this->errorAggregator = $errorAggregator;
     foreach ($this->errorMessageTemplates as $errorCode => $message) {
         $this->getErrorAggregator()->addErrorMessageTemplate($errorCode, $message);
     }
 }