/** * {@inheritdoc} */ protected function transformData($data, $sourceDocument, $destDocument, $recordTransformer, $destinationRecords) { parent::transformData($data, $sourceDocument, $destDocument, $recordTransformer, $destinationRecords); /** @var \Magento\Framework\DB\Adapter\Pdo\Mysql $adapter */ $adapter = $this->destination->getAdapter()->getSelect()->getAdapter(); $entityType = $this->helper->getEntityTypeData('entity_type_id', $data['entity_type_id']); $incrementMaxNumber = $this->helper->getMaxIncrementForEntityType($data['entity_type_id']); if ($incrementMaxNumber === false) { return; } foreach ($this->helper->getStoreIds() as $storeId) { $tableName = $this->helper->getTableName($entityType['entity_type_table'], $storeId); $adapter->insertOnDuplicate($tableName, [$entityType['column'] => $incrementMaxNumber]); } }
/** * @param int $storeId * @param int $metaId * @return void */ protected function addDataProfileTable($storeId, $metaId) { $incrementPrefix = $this->getIncrementPrefix($storeId); $data = ['meta_id' => $metaId, 'prefix' => $incrementPrefix ?: '']; $data = array_merge($this->defaultValuesProfile, $data); $this->destination->saveRecords($this->helper->getSequenceProfileTable(), [$data]); }
/** * {@inheritdoc} */ public function perform() { $this->progress->start(1); $this->progress->advance(); if (!$this->destination->getDocument($this->helper->getSequenceProfileTable())) { $this->missingDocuments[MapInterface::TYPE_DEST][$this->helper->getSequenceProfileTable()] = true; } else { $structureExistingSequenceProfileTable = array_keys($this->destination->getDocument($this->helper->getSequenceProfileTable())->getStructure()->getFields()); $this->checkStructure($this->helper->getSequenceProfileTable(), $this->helper->getSequenceProfileTable(true), $structureExistingSequenceProfileTable); } if (!$this->destination->getDocument($this->helper->getSequenceMetaTable())) { $this->missingDocuments[MapInterface::TYPE_DEST][$this->helper->getSequenceMetaTable()] = true; } else { $structureExistingSequenceMetaTable = array_keys($this->destination->getDocument($this->helper->getSequenceMetaTable())->getStructure()->getFields()); $this->checkStructure($this->helper->getSequenceMetaTable(), $this->helper->getSequenceMetaTable(true), $structureExistingSequenceMetaTable); } $this->progress->finish(); return $this->checkForErrors(); }