Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
Import Class Reference
Inheritance diagram for Import:
AbstractModel DataObject

Public Member Functions

 __construct (\Psr\Log\LoggerInterface $logger, \Magento\Framework\Filesystem $filesystem, \Magento\ImportExport\Helper\Data $importExportData, \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig, \Magento\ImportExport\Model\Import\ConfigInterface $importConfig, \Magento\ImportExport\Model\Import\Entity\Factory $entityFactory, \Magento\ImportExport\Model\ResourceModel\Import\Data $importData, \Magento\ImportExport\Model\Export\Adapter\CsvFactory $csvFactory, \Magento\Framework\HTTP\Adapter\FileTransferFactory $httpFactory, \Magento\MediaStorage\Model\File\UploaderFactory $uploaderFactory, \Magento\ImportExport\Model\Source\Import\Behavior\Factory $behaviorFactory, \Magento\Framework\Indexer\IndexerRegistry $indexerRegistry, \Magento\ImportExport\Model\History $importHistoryModel, DateTime $localeDate, array $data=[])
 
 getOperationResultMessages (ProcessingErrorAggregatorInterface $validationResult)
 
 getDataSourceModel ()
 
 getEntity ()
 
 getProcessedEntitiesCount ()
 
 getProcessedRowsCount ()
 
 getWorkingDir ()
 
 importSource ()
 
 isImportAllowed ()
 
 getErrorAggregator ()
 
 uploadFileAndGetSource ()
 
 validateSource (\Magento\ImportExport\Model\Import\AbstractSource $source)
 
 invalidateIndex ()
 
 getUniqueEntityBehaviors ()
 
 isReportEntityType ($entity=null)
 
 getCreatedItemsCount ()
 
 getUpdatedItemsCount ()
 
 getDeletedItemsCount ()
 
- Public Member Functions inherited from AbstractModel
 __construct (\Psr\Log\LoggerInterface $logger, \Magento\Framework\Filesystem $filesystem, array $data=[])
 
 addLogComment ($debugData)
 
 getFormatedLogTrace ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 

Static Public Member Functions

static getAttributeType (\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute)
 
static getDefaultBehavior ()
 

Data Fields

const BEHAVIOR_APPEND = 'append'
 
const BEHAVIOR_ADD_UPDATE = 'add_update'
 
const BEHAVIOR_REPLACE = 'replace'
 
const BEHAVIOR_DELETE = 'delete'
 
const BEHAVIOR_CUSTOM = 'custom'
 
const FIELD_NAME_SOURCE_FILE = 'import_file'
 
const FIELD_NAME_IMG_ARCHIVE_FILE = 'import_image_archive'
 
const FIELD_NAME_IMG_FILE_DIR = 'import_images_file_dir'
 
const FIELD_NAME_ALLOWED_ERROR_COUNT = 'allowed_error_count'
 
const FIELD_NAME_VALIDATION_STRATEGY = 'validation_strategy'
 
const FIELD_FIELD_SEPARATOR = '_import_field_separator'
 
const FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR = '_import_multiple_value_separator'
 
const FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT = '_import_empty_attribute_value_constant'
 
const FIELDS_ENCLOSURE = 'fields_enclosure'
 
const DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR = ','
 
const DEFAULT_EMPTY_ATTRIBUTE_VALUE_CONSTANT = '__EMPTY__VALUE__'
 
const DEFAULT_SIZE = 50
 
const MAX_IMPORT_CHUNKS = 4
 
const IMPORT_HISTORY_DIR = 'import_history/'
 
const IMPORT_DIR = 'import/'
 

Protected Member Functions

 _getEntityAdapter ()
 
 _getSourceAdapter ($sourceFile)
 
 processImport ()
 
 _removeBom ($sourceFile)
 
 createHistoryReport ($sourceFileRelative, $entity, $extension=null, $result=null)
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Protected Attributes

 $_entityAdapter
 
 $_importExportData = null
 
 $_importConfig
 
 $_entityFactory
 
 $_importData
 
 $_csvFactory
 
 $_httpFactory
 
 $_uploaderFactory
 
 $indexerRegistry
 
 $_behaviorFactory
 
 $_filesystem
 
- Protected Attributes inherited from AbstractModel
 $_debugMode = false
 
 $_debugReplacePrivateDataKeys = []
 
 $_logTrace = []
 
 $_logger
 
 $_varDirectory
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Additional Inherited Members

- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

Import model

@api

@method string getBehavior() getBehavior() @method \Magento\ImportExport\Model\Import setEntity() setEntity(string $value) @SuppressWarnings(PHPMD.CouplingBetweenObjects) @SuppressWarnings(PHPMD.ExcessiveClassComplexity)

Since
100.0.2

Definition at line 26 of file Import.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Psr\Log\LoggerInterface  $logger,
\Magento\Framework\Filesystem  $filesystem,
\Magento\ImportExport\Helper\Data  $importExportData,
\Magento\Framework\App\Config\ScopeConfigInterface  $coreConfig,
\Magento\ImportExport\Model\Import\ConfigInterface  $importConfig,
\Magento\ImportExport\Model\Import\Entity\Factory  $entityFactory,
\Magento\ImportExport\Model\ResourceModel\Import\Data  $importData,
\Magento\ImportExport\Model\Export\Adapter\CsvFactory  $csvFactory,
\Magento\Framework\HTTP\Adapter\FileTransferFactory  $httpFactory,
\Magento\MediaStorage\Model\File\UploaderFactory  $uploaderFactory,
\Magento\ImportExport\Model\Source\Import\Behavior\Factory  $behaviorFactory,
\Magento\Framework\Indexer\IndexerRegistry  $indexerRegistry,
\Magento\ImportExport\Model\History  $importHistoryModel,
DateTime  $localeDate,
array  $data = [] 
)
Parameters
\Psr\Log\LoggerInterface$logger
\Magento\Framework\Filesystem$filesystem
\Magento\ImportExport\Helper\Data$importExportData
\Magento\Framework\App\Config\ScopeConfigInterface$coreConfig
Import\ConfigInterface$importConfig
Import\Entity\Factory$entityFactory
\Magento\ImportExport\Model\ResourceModel\Import\Data$importData
Export\Adapter\CsvFactory$csvFactory
FileTransferFactory$httpFactory
\Magento\MediaStorage\Model\File\UploaderFactory$uploaderFactory
Source\Import\Behavior\Factory$behaviorFactory
\Magento\Framework\Indexer\IndexerRegistry$indexerRegistry
History$importHistoryModel
DateTime$localeDate
array$data@SuppressWarnings(PHPMD.ExcessiveParameterList)

Definition at line 200 of file Import.php.

216  {
217  $this->_importExportData = $importExportData;
218  $this->_coreConfig = $coreConfig;
219  $this->_importConfig = $importConfig;
220  $this->_entityFactory = $entityFactory;
221  $this->_importData = $importData;
222  $this->_csvFactory = $csvFactory;
223  $this->_httpFactory = $httpFactory;
224  $this->_uploaderFactory = $uploaderFactory;
225  $this->indexerRegistry = $indexerRegistry;
226  $this->_behaviorFactory = $behaviorFactory;
227  $this->_filesystem = $filesystem;
228  $this->importHistoryModel = $importHistoryModel;
229  $this->localeDate = $localeDate;
230  parent::__construct($logger, $filesystem, $data);
231  }
$logger
$filesystem

Member Function Documentation

◆ _getEntityAdapter()

_getEntityAdapter ( )
protected

Create instance of entity adapter and return it

Exceptions

Definition at line 239 of file Import.php.

240  {
241  if (!$this->_entityAdapter) {
242  $entities = $this->_importConfig->getEntities();
243  if (isset($entities[$this->getEntity()])) {
244  try {
245  $this->_entityAdapter = $this->_entityFactory->create($entities[$this->getEntity()]['model']);
246  } catch (\Exception $e) {
247  $this->_logger->critical($e);
248  throw new \Magento\Framework\Exception\LocalizedException(
249  __('Please enter a correct entity model.')
250  );
251  }
252  if (!$this->_entityAdapter instanceof \Magento\ImportExport\Model\Import\Entity\AbstractEntity &&
253  !$this->_entityAdapter instanceof \Magento\ImportExport\Model\Import\AbstractEntity
254  ) {
255  throw new \Magento\Framework\Exception\LocalizedException(
256  __(
257  'The entity adapter object must be an instance of %1 or %2.',
258  \Magento\ImportExport\Model\Import\Entity\AbstractEntity::class,
259  \Magento\ImportExport\Model\Import\AbstractEntity::class
260  )
261  );
262  }
263 
264  // check for entity codes integrity
265  if ($this->getEntity() != $this->_entityAdapter->getEntityTypeCode()) {
266  throw new \Magento\Framework\Exception\LocalizedException(
267  __('The input entity code is not equal to entity adapter code.')
268  );
269  }
270  } else {
271  throw new \Magento\Framework\Exception\LocalizedException(__('Please enter a correct entity.'));
272  }
273  $this->_entityAdapter->setParameters($this->getData());
274  }
275  return $this->_entityAdapter;
276  }
getData($key='', $index=null)
Definition: DataObject.php:119
__()
Definition: __.php:13

◆ _getSourceAdapter()

_getSourceAdapter (   $sourceFile)
protected

Returns source adapter object.

Parameters
string$sourceFileFull path to source file
Returns
\Magento\ImportExport\Model\Import\AbstractSource
Exceptions

Definition at line 285 of file Import.php.

286  {
287  return \Magento\ImportExport\Model\Import\Adapter::findAdapterFor(
288  $sourceFile,
289  $this->_filesystem->getDirectoryWrite(DirectoryList::ROOT),
290  $this->getData(self::FIELD_FIELD_SEPARATOR)
291  );
292  }
getData($key='', $index=null)
Definition: DataObject.php:119

◆ _removeBom()

_removeBom (   $sourceFile)
protected

Remove BOM from a file

Parameters
string$sourceFile
Returns
$this
Exceptions

Definition at line 577 of file Import.php.

578  {
579  $string = $this->_varDirectory->readFile($this->_varDirectory->getRelativePath($sourceFile));
580  if ($string !== false && substr($string, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
581  $string = substr($string, 3);
582  $this->_varDirectory->writeFile($this->_varDirectory->getRelativePath($sourceFile), $string);
583  }
584  return $this;
585  }

◆ createHistoryReport()

createHistoryReport (   $sourceFileRelative,
  $entity,
  $extension = null,
  $result = null 
)
protected

Create history report

Parameters
string$sourceFileRelative
string$entity
string$extension
array$result
Returns
$this
Exceptions

Definition at line 758 of file Import.php.

759  {
760  if ($this->isReportEntityType($entity)) {
761  if (is_array($sourceFileRelative)) {
762  $fileName = $sourceFileRelative['file_name'];
763  $sourceFileRelative = $this->_varDirectory->getRelativePath(self::IMPORT_DIR . $fileName);
764  } elseif (isset($result['name'])) {
765  $fileName = $result['name'];
766  } elseif ($extension !== null) {
768  } else {
769  $fileName = basename($sourceFileRelative);
770  }
771  $copyName = $this->localeDate->gmtTimestamp() . '_' . $fileName;
772  $copyFile = self::IMPORT_HISTORY_DIR . $copyName;
773  try {
774  if ($this->_varDirectory->isExist($sourceFileRelative)) {
775  $this->_varDirectory->copyFile($sourceFileRelative, $copyFile);
776  } else {
777  $content = $this->_varDirectory->getDriver()->fileGetContents($sourceFileRelative);
778  $this->_varDirectory->writeFile($copyFile, $content);
779  }
780  } catch (\Magento\Framework\Exception\FileSystemException $e) {
781  throw new \Magento\Framework\Exception\LocalizedException(__('Source file coping failed'));
782  }
783  $this->importHistoryModel->addReport($copyName);
784  }
785  return $this;
786  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
isReportEntityType($entity=null)
Definition: Import.php:723
__()
Definition: __.php:13
$fileName
Definition: translate.phtml:15
$entity
Definition: element.phtml:22

◆ getAttributeType()

static getAttributeType ( \Magento\Eav\Model\Entity\Attribute\AbstractAttribute  $attribute)
static

Get attribute type for upcoming validation.

Parameters
\Magento\Eav\Model\Entity\Attribute\AbstractAttribute | \Magento\Eav\Model\Entity\Attribute$attribute
Returns
string

Definition at line 345 of file Import.php.

346  {
347  $frontendInput = $attribute->getFrontendInput();
348  if ($attribute->usesSource() && in_array($frontendInput, ['select', 'multiselect', 'boolean'])) {
349  return $frontendInput;
350  } elseif ($attribute->isStatic()) {
351  return $frontendInput == 'date' ? 'datetime' : 'varchar';
352  } else {
353  return $attribute->getBackendType();
354  }
355  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17

◆ getCreatedItemsCount()

getCreatedItemsCount ( )

Get count of created items

Returns
int
Exceptions

Definition at line 794 of file Import.php.

795  {
796  return $this->_getEntityAdapter()->getCreatedItemsCount();
797  }

◆ getDataSourceModel()

getDataSourceModel ( )

DB data source model getter.

Returns
\Magento\ImportExport\Model\ResourceModel\Import\Data

Definition at line 362 of file Import.php.

363  {
364  return $this->_importData;
365  }

◆ getDefaultBehavior()

static getDefaultBehavior ( )
static

Default import behavior getter.

Returns
string

Definition at line 373 of file Import.php.

374  {
375  return self::BEHAVIOR_APPEND;
376  }

◆ getDeletedItemsCount()

getDeletedItemsCount ( )

Get count of deleted items

Returns
int
Exceptions

Definition at line 816 of file Import.php.

817  {
818  return $this->_getEntityAdapter()->getDeletedItemsCount();
819  }

◆ getEntity()

getEntity ( )

Override standard entity getter.

Exceptions

Definition at line 384 of file Import.php.

385  {
386  if (empty($this->_data['entity'])) {
387  throw new \Magento\Framework\Exception\LocalizedException(__('Entity is unknown'));
388  }
389  return $this->_data['entity'];
390  }
__()
Definition: __.php:13

◆ getErrorAggregator()

getErrorAggregator ( )

Provides error aggregator.

Returns
ProcessingErrorAggregatorInterface
Exceptions

Definition at line 489 of file Import.php.

490  {
491  return $this->_getEntityAdapter()->getErrorAggregator();
492  }

◆ getOperationResultMessages()

getOperationResultMessages ( ProcessingErrorAggregatorInterface  $validationResult)

Return operation result messages

Parameters
ProcessingErrorAggregatorInterface$validationResult
Returns
string[]
Exceptions

Definition at line 301 of file Import.php.

302  {
303  $messages = [];
304  if ($this->getProcessedRowsCount()) {
305  if ($validationResult->getErrorsCount()) {
306  $messages[] = __('Data validation failed. Please fix the following errors and upload the file again.');
307 
308  // errors info
309  foreach ($validationResult->getRowsGroupedByErrorCode() as $errorMessage => $rows) {
310  $error = $errorMessage . ' ' . __('in row(s)') . ': ' . implode(', ', $rows);
311  $messages[] = $error;
312  }
313  } else {
314  if ($this->isImportAllowed()) {
315  $messages[] = __('The validation is complete.');
316  } else {
317  $messages[] = __('The file is valid, but we can\'t import it for some reason.');
318  }
319  }
320 
321  $messages[] = __(
322  'Checked rows: %1, checked entities: %2, invalid rows: %3, total errors: %4',
323  $this->getProcessedRowsCount(),
324  $this->getProcessedEntitiesCount(),
325  $validationResult->getInvalidRowsCount(),
326  $validationResult->getErrorsCount(
327  [
330  ]
331  )
332  );
333  } else {
334  $messages[] = __('This file does not contain any data.');
335  }
336  return $messages;
337  }
__()
Definition: __.php:13

◆ getProcessedEntitiesCount()

getProcessedEntitiesCount ( )

Returns number of checked entities.

Returns
int
Exceptions

Definition at line 398 of file Import.php.

399  {
400  return $this->_getEntityAdapter()->getProcessedEntitiesCount();
401  }

◆ getProcessedRowsCount()

getProcessedRowsCount ( )

Returns number of checked rows.

Returns
int
Exceptions

Definition at line 409 of file Import.php.

410  {
411  return $this->_getEntityAdapter()->getProcessedRowsCount();
412  }

◆ getUniqueEntityBehaviors()

getUniqueEntityBehaviors ( )

Get array of unique entity behaviors array( <behavior_model_code> => <behavior_class_name>, ... )

Returns
array
Exceptions

Definition at line 703 of file Import.php.

704  {
705  $uniqueBehaviors = [];
706  $behaviourData = $this->getEntityBehaviors();
707  foreach ($behaviourData as $behavior) {
708  $behaviorCode = $behavior['code'];
709  if (!isset($uniqueBehaviors[$behaviorCode])) {
710  $uniqueBehaviors[$behaviorCode] = $behavior['token'];
711  }
712  }
713  return $uniqueBehaviors;
714  }

◆ getUpdatedItemsCount()

getUpdatedItemsCount ( )

Get count of updated items

Returns
int
Exceptions

Definition at line 805 of file Import.php.

806  {
807  return $this->_getEntityAdapter()->getUpdatedItemsCount();
808  }

◆ getWorkingDir()

getWorkingDir ( )

Import/Export working directory (source files, result files, lock files etc.).

Returns
string

Definition at line 419 of file Import.php.

420  {
421  return $this->_varDirectory->getAbsolutePath('importexport/');
422  }

◆ importSource()

importSource ( )

Import source file structure to DB.

Returns
bool
Exceptions

Definition at line 430 of file Import.php.

431  {
432  $this->setData('entity', $this->getDataSourceModel()->getEntityTypeCode());
433  $this->setData('behavior', $this->getDataSourceModel()->getBehavior());
434  $this->importHistoryModel->updateReport($this);
435 
436  $this->addLogComment(__('Begin import of "%1" with "%2" behavior', $this->getEntity(), $this->getBehavior()));
437 
438  $result = $this->processImport();
439 
440  if ($result) {
441  $this->addLogComment(
442  [
443  __(
444  'Checked rows: %1, checked entities: %2, invalid rows: %3, total errors: %4',
445  $this->getProcessedRowsCount(),
446  $this->getProcessedEntitiesCount(),
447  $this->getErrorAggregator()->getInvalidRowsCount(),
448  $this->getErrorAggregator()->getErrorsCount()
449  ),
450  __('The import was successful.'),
451  ]
452  );
453  $this->importHistoryModel->updateReport($this, true);
454  } else {
455  $this->importHistoryModel->invalidateReport($this);
456  }
457 
458  return $result;
459  }
__()
Definition: __.php:13
setData($key, $value=null)
Definition: DataObject.php:72

◆ invalidateIndex()

invalidateIndex ( )

Invalidate indexes by process codes.

Returns
$this
Exceptions

Definition at line 636 of file Import.php.

637  {
638  $relatedIndexers = $this->_importConfig->getRelatedIndexers($this->getEntity());
639  if (empty($relatedIndexers)) {
640  return $this;
641  }
642 
643  foreach (array_keys($relatedIndexers) as $indexerId) {
644  try {
645  $indexer = $this->indexerRegistry->get($indexerId);
646 
647  if (!$indexer->isScheduled()) {
648  $indexer->invalidate();
649  }
650  } catch (\InvalidArgumentException $e) {
651  }
652  }
653 
654  return $this;
655  }

◆ isImportAllowed()

isImportAllowed ( )

Import possibility getter.

Returns
bool
Exceptions

Definition at line 478 of file Import.php.

479  {
480  return $this->_getEntityAdapter()->isImportAllowed();
481  }

◆ isReportEntityType()

isReportEntityType (   $entity = null)

Retrieve processed reports entity types

Parameters
string | null$entity
Returns
bool
Exceptions

Definition at line 723 of file Import.php.

724  {
725  $result = false;
726  if (!$entity) {
727  $entity = $this->getEntity();
728  }
729  if ($entity !== null && $this->_getEntityAdapter()->getEntityTypeCode() != $entity) {
730  $entities = $this->_importConfig->getEntities();
731  if (isset($entities[$entity])) {
732  try {
733  $result = $this->_getEntityAdapter()->isNeedToLogInHistory();
734  } catch (\Exception $e) {
735  throw new \Magento\Framework\Exception\LocalizedException(
736  __('Please enter a correct entity model')
737  );
738  }
739  } else {
740  throw new \Magento\Framework\Exception\LocalizedException(__('Please enter a correct entity model'));
741  }
742  } else {
743  $result = $this->_getEntityAdapter()->isNeedToLogInHistory();
744  }
745  return $result;
746  }
__()
Definition: __.php:13
$entity
Definition: element.phtml:22

◆ processImport()

processImport ( )
protected

Process import.

Returns
bool
Exceptions

Definition at line 467 of file Import.php.

468  {
469  return $this->_getEntityAdapter()->importData();
470  }

◆ uploadFileAndGetSource()

uploadFileAndGetSource ( )

Move uploaded file and provide source instance.

Returns
Import\AbstractSource
Exceptions

Definition at line 557 of file Import.php.

558  {
559  $sourceFile = $this->uploadSource();
560  try {
561  $source = $this->_getSourceAdapter($sourceFile);
562  } catch (\Exception $e) {
563  $this->_varDirectory->delete($this->_varDirectory->getRelativePath($sourceFile));
564  throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()));
565  }
566 
567  return $source;
568  }
$source
Definition: source.php:23
__()
Definition: __.php:13

◆ validateSource()

Validates source file and returns validation result

Before validate data the method requires to initialize error aggregator (ProcessingErrorAggregatorInterface) with 'validation strategy' and 'allowed error count' values to allow using this parameters in validation process.

Parameters
\Magento\ImportExport\Model\Import\AbstractSource$source
Returns
bool
Exceptions

Definition at line 597 of file Import.php.

598  {
599  $this->addLogComment(__('Begin data validation'));
600 
601  $errorAggregator = $this->getErrorAggregator();
602  $errorAggregator->initValidationStrategy(
603  $this->getData(self::FIELD_NAME_VALIDATION_STRATEGY),
604  $this->getData(self::FIELD_NAME_ALLOWED_ERROR_COUNT)
605  );
606 
607  try {
608  $adapter = $this->_getEntityAdapter()->setSource($source);
609  $adapter->validateData();
610  } catch (\Exception $e) {
611  $errorAggregator->addError(
614  null,
615  null,
616  $e->getMessage()
617  );
618  }
619 
620  $messages = $this->getOperationResultMessages($errorAggregator);
621  $this->addLogComment($messages);
622 
623  $result = !$errorAggregator->getErrorsCount();
624  if ($result) {
625  $this->addLogComment(__('Import data validation is complete.'));
626  }
627  return $result;
628  }
getData($key='', $index=null)
Definition: DataObject.php:119
$source
Definition: source.php:23
__()
Definition: __.php:13
getOperationResultMessages(ProcessingErrorAggregatorInterface $validationResult)
Definition: Import.php:301
$adapter
Definition: webapi_user.php:16

Field Documentation

◆ $_behaviorFactory

$_behaviorFactory
protected

Definition at line 165 of file Import.php.

◆ $_csvFactory

$_csvFactory
protected

Definition at line 145 of file Import.php.

◆ $_entityAdapter

$_entityAdapter
protected

#- #-

Definition at line 118 of file Import.php.

◆ $_entityFactory

$_entityFactory
protected

Definition at line 135 of file Import.php.

◆ $_filesystem

$_filesystem
protected

Definition at line 170 of file Import.php.

◆ $_httpFactory

$_httpFactory
protected

Definition at line 150 of file Import.php.

◆ $_importConfig

$_importConfig
protected

Definition at line 130 of file Import.php.

◆ $_importData

$_importData
protected

Definition at line 140 of file Import.php.

◆ $_importExportData

$_importExportData = null
protected

Definition at line 125 of file Import.php.

◆ $_uploaderFactory

$_uploaderFactory
protected

Definition at line 155 of file Import.php.

◆ $indexerRegistry

$indexerRegistry
protected

Definition at line 160 of file Import.php.

◆ BEHAVIOR_ADD_UPDATE

const BEHAVIOR_ADD_UPDATE = 'add_update'

Definition at line 33 of file Import.php.

◆ BEHAVIOR_APPEND

const BEHAVIOR_APPEND = 'append'

#+ Import behaviors

Definition at line 31 of file Import.php.

◆ BEHAVIOR_CUSTOM

const BEHAVIOR_CUSTOM = 'custom'

Definition at line 39 of file Import.php.

◆ BEHAVIOR_DELETE

const BEHAVIOR_DELETE = 'delete'

Definition at line 37 of file Import.php.

◆ BEHAVIOR_REPLACE

const BEHAVIOR_REPLACE = 'replace'

Definition at line 35 of file Import.php.

◆ DEFAULT_EMPTY_ATTRIBUTE_VALUE_CONSTANT

const DEFAULT_EMPTY_ATTRIBUTE_VALUE_CONSTANT = '__EMPTY__VALUE__'

default empty attribute value constant

Definition at line 102 of file Import.php.

◆ DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR

const DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR = ','

#- default delimiter for several values in one cell as default for FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR

Definition at line 97 of file Import.php.

◆ DEFAULT_SIZE

const DEFAULT_SIZE = 50

#+ Import constants

Definition at line 107 of file Import.php.

◆ FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT

const FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT = '_import_empty_attribute_value_constant'

Import empty attribute value constant.

Definition at line 85 of file Import.php.

◆ FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR

const FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR = '_import_multiple_value_separator'

Import multiple value separator.

Definition at line 80 of file Import.php.

◆ FIELD_FIELD_SEPARATOR

const FIELD_FIELD_SEPARATOR = '_import_field_separator'

Import field separator.

Definition at line 75 of file Import.php.

◆ FIELD_NAME_ALLOWED_ERROR_COUNT

const FIELD_NAME_ALLOWED_ERROR_COUNT = 'allowed_error_count'

Allowed errors count field name

Definition at line 65 of file Import.php.

◆ FIELD_NAME_IMG_ARCHIVE_FILE

const FIELD_NAME_IMG_ARCHIVE_FILE = 'import_image_archive'

Import image archive.

Definition at line 55 of file Import.php.

◆ FIELD_NAME_IMG_FILE_DIR

const FIELD_NAME_IMG_FILE_DIR = 'import_images_file_dir'

Import images file directory.

Definition at line 60 of file Import.php.

◆ FIELD_NAME_SOURCE_FILE

const FIELD_NAME_SOURCE_FILE = 'import_file'

#- #+ Form field names (and IDs)Import source file.

Definition at line 50 of file Import.php.

◆ FIELD_NAME_VALIDATION_STRATEGY

const FIELD_NAME_VALIDATION_STRATEGY = 'validation_strategy'

Validation startegt field name

Definition at line 70 of file Import.php.

◆ FIELDS_ENCLOSURE

const FIELDS_ENCLOSURE = 'fields_enclosure'

Allow multiple values wrapping in double quotes for additional attributes.

Definition at line 90 of file Import.php.

◆ IMPORT_DIR

const IMPORT_DIR = 'import/'

Definition at line 113 of file Import.php.

◆ IMPORT_HISTORY_DIR

const IMPORT_HISTORY_DIR = 'import_history/'

Definition at line 111 of file Import.php.

◆ MAX_IMPORT_CHUNKS

const MAX_IMPORT_CHUNKS = 4

Definition at line 109 of file Import.php.


The documentation for this class was generated from the following file: