/** * {@inheritdoc} */ public function perform() { $this->progress->start(count($this->helper->getDocumentList())); $documents = $this->helper->getDocumentList(); foreach ($documents as $sourceDocName => $destDocName) { $this->progress->advance(); $sourceDocument = $this->source->getDocument($sourceDocName); $destinationDocument = $this->destination->getDocument($destDocName); $this->destination->clearDocument($destDocName); $pageNumber = 0; while (!empty($sourceRecords = $this->source->getRecords($sourceDocName, $pageNumber))) { $pageNumber++; $recordsToSave = $destinationDocument->getRecords(); foreach ($sourceRecords as $recordData) { /** @var ResourceModel\Record $destinationRecord */ $destinationRecord = $this->recordFactory->create(['document' => $destinationDocument]); if ($this->haveEqualStructure($sourceDocument, $destinationDocument)) { $destinationRecord->setData($recordData); } else { $destinationRecord = $this->transformRecord($destinationRecord, $recordData); } $recordsToSave->addRecord($destinationRecord); } $this->destination->saveRecords($destinationDocument->getName(), $recordsToSave); } } $this->progress->finish(); return true; }
/** * @return bool */ public function perform() { $this->helper->init(); $this->progress->start($this->getIterationsCount(), LogManager::LOG_LEVEL_INFO); $document = $this->helper->getDocumentList(); $sourceDocumentName = $document['source']; $destinationDocumentName = $document['destination']; $destinationDocument = $this->destination->getDocument($destinationDocumentName); $pageNumber = 0; $this->logger->debug('migrating', ['table' => $sourceDocumentName]); $this->progress->start($this->source->getRecordsCount($sourceDocumentName), LogManager::LOG_LEVEL_DEBUG); /** @var \Magento\Framework\DB\Select $select */ $select = $this->getConfigurablePrice(); while (!empty($bulk = $this->getRecords($sourceDocumentName, $select, $pageNumber))) { $pageNumber++; $destinationCollection = $destinationDocument->getRecords(); foreach ($bulk as $recordData) { $this->progress->advance(LogManager::LOG_LEVEL_INFO); $this->progress->advance(LogManager::LOG_LEVEL_DEBUG); /** @var Record $destinationRecord */ $destinationRecord = $this->recordFactory->create(['document' => $destinationDocument, 'data' => $recordData]); $destinationCollection->addRecord($destinationRecord); } $this->destination->saveRecords($destinationDocumentName, $destinationCollection, true); $this->progress->finish(LogManager::LOG_LEVEL_DEBUG); } $this->progress->finish(LogManager::LOG_LEVEL_INFO); return true; }
/** * {@inheritdoc} */ public function perform() { $this->progress->start(1); $this->progress->advance(); $ratingsShouldBeActive = []; $ratingsIsActive = []; /** @var \Migration\ResourceModel\Adapter\Mysql $adapter */ $adapter = $this->destination->getAdapter(); /** @var \Magento\Framework\DB\Select $select */ $select = $adapter->getSelect()->from($this->getRatingStoreDocument(), ['rating_id'])->where('store_id > 0'); $ratingsStore = $adapter->loadDataFromSelect($select); foreach ($ratingsStore as $rating) { $ratingsShouldBeActive[] = $rating['rating_id']; } $ratingsShouldBeActive = array_unique($ratingsShouldBeActive); /** @var \Magento\Framework\DB\Select $select */ $select = $adapter->getSelect()->from($this->getRatingDocument(), ['rating_id'])->where('is_active = ?', 1); $ratings = $adapter->loadDataFromSelect($select); foreach ($ratings as $rating) { $ratingsIsActive[] = $rating['rating_id']; } if (count(array_intersect($ratingsShouldBeActive, $ratingsIsActive)) != count($ratingsShouldBeActive)) { $this->errors[] = sprintf('Mismatch of entities in the documents: %s, %s', self::RATING_TABLE_NAME, self::RATING_STORE_TABLE_NAME); } $this->progress->finish(); return $this->checkForErrors(Logger::ERROR); }
/** * @return bool */ public function perform() { // catalog_product_entity_tier_price should be migrated first to save same value_id as into magento1 $sourceDocuments = array_keys($this->helper->getSourceDocumentFields()); $this->progress->start(count($sourceDocuments), LogManager::LOG_LEVEL_INFO); $destinationName = $this->helper->getDestinationName(); $this->destination->clearDocument($destinationName); $destDocument = $this->destination->getDocument($destinationName); foreach ($sourceDocuments as $sourceDocName) { $pageNumber = 0; $this->logger->debug('migrating', ['table' => $sourceDocName]); $this->progress->start($this->source->getRecordsCount($sourceDocName), LogManager::LOG_LEVEL_DEBUG); while (!empty($items = $this->source->getRecords($sourceDocName, $pageNumber))) { $pageNumber++; $destinationRecords = $destDocument->getRecords(); foreach ($items as $recordData) { unset($recordData['value_id']); $this->progress->advance(LogManager::LOG_LEVEL_INFO); $this->progress->advance(LogManager::LOG_LEVEL_DEBUG); /** @var Record $destRecord */ $destRecord = $this->recordFactory->create(['document' => $destDocument, 'data' => $recordData]); $destinationRecords->addRecord($destRecord); } $this->destination->saveRecords($destinationName, $destinationRecords); } $this->progress->finish(LogManager::LOG_LEVEL_DEBUG); } $this->progress->finish(LogManager::LOG_LEVEL_INFO); return true; }
/** * {@inheritdoc} */ public function perform() { $this->progress->start($this->getIterationsCount()); $this->checkFields($this->helper->getSourceDocumentFields(), MapInterface::TYPE_SOURCE); $this->checkFields($this->helper->getDestinationDocumentFields(), MapInterface::TYPE_DEST); $this->progress->finish(); return $this->checkForErrors(); }
/** * @return bool */ public function perform() { $this->progress->start(count($this->groups->getGroup('documents'))); $this->validateAttributes(); $this->validateAttributeSetsAndGroups(); $this->progress->finish(); return $this->checkForErrors(); }
/** * @return bool */ public function perform() { $documents = $this->helper->getDocumentList(); $this->progressBar->start(1); $oldDestinationRecordsCount = $this->helper->getDestinationRecordsCount(); $newDestinationRecordsCount = $this->destination->getRecordsCount($documents[MapInterface::TYPE_DEST]) - $oldDestinationRecordsCount; if ($newDestinationRecordsCount != 0) { $this->errors[] = 'Mismatch of entities in the document: ' . $documents[MapInterface::TYPE_DEST]; } $this->progressBar->finish(); return $this->checkForErrors(); }
/** * @return bool */ public function perform() { $this->progress->start(count($this->groups->getGroup('documents'))); $this->validateAttributes(); $this->validateAttributeSetsAndGroups(); $this->progress->finish(); $result = $this->checkForErrors(Logger::ERROR); if ($result) { $this->helper->deleteBackups(); } return $result; }
/** * {@inheritdoc} */ public function perform() { $result = true; $this->progress->start(count($this->helper->getDocumentList())); foreach ($this->helper->getDocumentList() as $sourceName => $destinationName) { $this->progress->advance(); $result &= (bool) $this->source->getDocument($sourceName); $result &= (bool) $this->destination->getDocument($destinationName); } $this->progress->finish(); return (bool) $result; }
/** * {@inheritdoc} */ public function perform() { $this->progress->start(count($this->helper->getDocumentList())); foreach ($this->helper->getDocumentList() as $sourceName => $destinationName) { $this->progress->advance(); if ($this->source->getRecordsCount($sourceName) != $this->destination->getRecordsCount($destinationName)) { $this->errors[] = 'Mismatch of entities in the document: ' . $destinationName; } } $this->progress->finish(); return $this->checkForErrors(Logger::ERROR); }
/** * @return bool */ public function perform() { $this->progressBar->start($this->getIterationsCount()); foreach ($this->helper->getDocumentList() as $sourceDocumentName => $destinationDocumentName) { $this->progressBar->advance(); $sourceRecordsCount = $this->source->getRecordsCount($sourceDocumentName); $destinationRecordsCount = $this->destination->getRecordsCount($destinationDocumentName); if ($sourceRecordsCount != $destinationRecordsCount) { $this->errors[] = 'Mismatch of entities in the document: ' . $destinationDocumentName; } } $this->progressBar->finish(); return $this->checkForErrors(); }
/** * @return bool */ public function perform() { $deltaLogs = $this->groupsReader->getGroups(); $this->progress->start(count($deltaLogs, 1) - count($deltaLogs)); foreach ($deltaLogs as $deltaDocuments) { foreach ($deltaDocuments as $documentName => $idKey) { $this->progress->advance(); if ($this->source->getDocument($documentName)) { $this->source->createDelta($documentName, $idKey); } } } $this->progress->finish(); return true; }
/** * {@inheritdoc} */ public function perform() { $this->progress->start(count($this->helper->getSourceDocumentFields())); $sourceTotal = 0; $destinationTotal = $this->destination->getRecordsCount($this->helper->getDestinationName()); foreach (array_keys($this->helper->getSourceDocumentFields()) as $sourceName) { $sourceTotal += $this->source->getRecordsCount($sourceName); $this->progress->advance(); } if ($sourceTotal != $destinationTotal) { $this->errors[] = 'Mismatch of amount of entities in documents'; } $this->progress->finish(); return $this->checkForErrors(Logger::ERROR); }
/** * {@inheritdoc} */ public function perform() { $this->progress->start($this->getIterationsCount()); foreach ($this->helper->getDocumentList() as $documentName) { $this->progress->advance(); $documentColumns = $this->helper->getDocumentColumns($documentName); $destinationDocumentStructure = array_keys($this->destination->getStructure($documentName)->getFields()); foreach (array_diff($documentColumns, $destinationDocumentStructure) as $columnDiff) { $message = sprintf('%s table does not contain field: %s', $documentName, $columnDiff); $this->logger->error($message); } } $this->progress->finish(); return $this->checkForErrors(); }
/** * {@inheritdoc} */ public function perform() { $this->progressBar->start(1, LogManager::LOG_LEVEL_INFO); $this->progressBar->advance(LogManager::LOG_LEVEL_INFO); $this->destination->clearDocument($this->helper->getSequenceMetaTable()); $this->destination->clearDocument($this->helper->getSequenceProfileTable()); foreach ($this->helper->getEntityTypeTablesMap() as $entityType) { foreach ($this->helper->getStoreIds() as $storeId) { $this->createSequenceTable($entityType, $storeId); $metaId = $this->addDataMetaTable($entityType, $storeId); $this->addDataProfileTable($storeId, $metaId); } } $this->progressBar->finish(LogManager::LOG_LEVEL_INFO); return true; }
/** * @return bool */ public function perform() { $sourceDocuments = array_keys($this->helper->getDocumentList()); $this->progress->start(count($sourceDocuments)); foreach ($sourceDocuments as $sourceDocName) { $this->progress->advance(); $destinationName = $this->map->getDocumentMap($sourceDocName, MapInterface::TYPE_SOURCE); if (!$destinationName) { continue; } $this->checkMapEntities($sourceDocName, $destinationName); $this->checkEavEntities(); } $this->progress->finish(); return $this->checkForErrors(); }
/** * {@inheritdoc} */ public function perform() { $destinationDocument = $this->destination->getDocument(self::CONFIG_TABLE_NAME_DESTINATION); $recordsCountSource = $this->source->getRecordsCount(self::CONFIG_TABLE_NAME_SOURCE); $recordsCountDestination = $this->destination->getRecordsCount(self::CONFIG_TABLE_NAME_DESTINATION); $this->progress->start($recordsCountSource); $sourceRecords = $this->source->getRecords(self::CONFIG_TABLE_NAME_SOURCE, 0, $recordsCountSource); $destinationRecords = $this->destination->getRecords(self::CONFIG_TABLE_NAME_DESTINATION, 0, $recordsCountDestination); foreach ($sourceRecords as $sourceRecord) { $this->progress->advance(); if (!$this->readerSettings->isNodeIgnored($sourceRecord[self::CONFIG_FIELD_PATH])) { $sourceRecordPathMapped = $this->readerSettings->getNodeMap($sourceRecord[self::CONFIG_FIELD_PATH]); foreach ($destinationRecords as &$destinationRecord) { if ($destinationRecord[self::CONFIG_FIELD_SCOPE] == $sourceRecord[self::CONFIG_FIELD_SCOPE] && $destinationRecord[self::CONFIG_FIELD_SCOPE_ID] == $sourceRecord[self::CONFIG_FIELD_SCOPE_ID] && $destinationRecord[self::CONFIG_FIELD_PATH] == $sourceRecordPathMapped) { $record = $this->applyHandler($destinationDocument, $sourceRecord, $destinationRecord); $destinationRecord[self::CONFIG_FIELD_VALUE] = $record->getValue(self::CONFIG_FIELD_VALUE); continue 2; } } $record = $this->applyHandler($destinationDocument, $sourceRecord, []); $record->setValue(self::CONFIG_FIELD_PATH, $sourceRecordPathMapped); $destinationRecords[] = $record->getData(); } } foreach ($destinationRecords as &$destinationRecord) { unset($destinationRecord[self::CONFIG_FIELD_CONFIG_ID]); } $this->destination->clearDocument(self::CONFIG_TABLE_NAME_DESTINATION); $this->destination->saveRecords(self::CONFIG_TABLE_NAME_DESTINATION, $destinationRecords); $this->progress->finish(); return true; }
/** * @return bool */ public function perform() { $this->progressBar->start(count($this->source->getDocumentList()), LogManager::LOG_LEVEL_INFO); $sourceDocuments = $this->source->getDocumentList(); // TODO: during steps refactoring MAGETWO-35749 stage will be removed $stage = 'run'; $processedDocuments = $this->progress->getProcessedEntities($this, $stage); foreach ($sourceDocuments as $sourceDocName) { $this->progressBar->advance(LogManager::LOG_LEVEL_INFO); if (in_array($sourceDocName, $processedDocuments)) { continue; } $sourceDocument = $this->source->getDocument($sourceDocName); $destinationName = $this->map->getDocumentMap($sourceDocName, MapInterface::TYPE_SOURCE); if (!$destinationName) { continue; } $destDocument = $this->destination->getDocument($destinationName); $this->destination->clearDocument($destinationName); $recordTransformer = $this->getRecordTransformer($sourceDocument, $destDocument); $pageNumber = 0; $this->logger->debug('migrating', ['table' => $sourceDocName]); $this->progressBar->start($this->source->getRecordsCount($sourceDocName), LogManager::LOG_LEVEL_DEBUG); while (!empty($items = $this->source->getRecords($sourceDocName, $pageNumber))) { $pageNumber++; $destinationRecords = $destDocument->getRecords(); foreach ($items as $data) { $this->progressBar->advance(LogManager::LOG_LEVEL_DEBUG); if ($recordTransformer) { /** @var Record $record */ $record = $this->recordFactory->create(['document' => $sourceDocument, 'data' => $data]); /** @var Record $destRecord */ $destRecord = $this->recordFactory->create(['document' => $destDocument]); $recordTransformer->transform($record, $destRecord); } else { $destRecord = $this->recordFactory->create(['document' => $destDocument, 'data' => $data]); } $destinationRecords->addRecord($destRecord); } $this->destination->saveRecords($destinationName, $destinationRecords); } $this->progress->addProcessedEntity($this, $stage, $sourceDocName); $this->progressBar->finish(LogManager::LOG_LEVEL_DEBUG); } $this->progressBar->finish(LogManager::LOG_LEVEL_INFO); return true; }
/** * @return bool */ public function perform() { $this->progress->start($this->getIterationsCount(), LogManager::LOG_LEVEL_INFO); foreach ($this->getDocumentList() as $methodToExecute => $document) { $destinationDocumentName = $document['destination']; $this->destination->clearDocument($destinationDocumentName); $this->progress->start(1, LogManager::LOG_LEVEL_DEBUG); $sourceGridDocument = array_flip($this->helper->getDocumentList())[$destinationDocumentName]; $entityIds = $this->getEntityIdsFromSourceGrid($sourceGridDocument); if ($entityIds) { $this->destination->getAdapter()->insertFromSelect($this->{$methodToExecute}($document['columns'], $entityIds), $this->destination->addDocumentPrefix($destinationDocumentName), [], \Magento\Framework\Db\Adapter\AdapterInterface::INSERT_ON_DUPLICATE); } $this->progress->finish(LogManager::LOG_LEVEL_DEBUG); } $this->progress->finish(LogManager::LOG_LEVEL_INFO); return true; }
/** * {@inheritdoc} */ public function perform() { $this->progress->start(1); $this->progress->advance(); $documents = $this->destination->getDocumentList(); if (!in_array(self::RATING_TABLE_NAME, $documents) || !in_array(self::RATING_STORE_TABLE_NAME, $documents)) { $this->logger->error(sprintf('"%s" or "%s" documents do not exist in the destination resource', self::RATING_TABLE_NAME, self::RATING_STORE_TABLE_NAME)); return false; } $structureRating = $this->destination->getDocument(self::RATING_TABLE_NAME)->getStructure()->getFields(); if (!array_key_exists('is_active', $structureRating)) { $this->logger->error(sprintf('"is_active" field does not exist in "%s" document of' . ' the destination resource', self::RATING_TABLE_NAME)); return false; } $this->progress->finish(); return true; }
/** * {@inheritdoc} */ public function perform() { $this->progress->start(1); $this->progress->advance(); $documents = $this->source->getDocumentList(); if (!in_array(self::CONFIG_TABLE_NAME_SOURCE, $documents)) { $this->logger->error(sprintf('Integrity check failed due to "%s" document does not exist in the source resource', self::CONFIG_TABLE_NAME_SOURCE)); return false; } $documents = $this->destination->getDocumentList(); if (!in_array(self::CONFIG_TABLE_NAME_DESTINATION, $documents)) { $this->logger->error(sprintf('Integrity check failed due to "%s" document does not exist in the destination resource', self::CONFIG_TABLE_NAME_DESTINATION)); return false; } $this->progress->finish(); return true; }
/** * @return bool */ public function perform() { $sourceDocuments = array_keys($this->readerGroups->getGroup('source_documents')); $this->progress->start($this->getIterationsCount()); foreach ($sourceDocuments as $sourceDocName) { $this->progress->advance(); $destinationName = $this->map->getDocumentMap($sourceDocName, MapInterface::TYPE_SOURCE); if (!$destinationName) { continue; } $sourceCount = $this->helper->getSourceRecordsCount($sourceDocName); $destinationCount = $this->destination->getRecordsCount($destinationName); if ($sourceCount != $destinationCount) { $this->errors[] = 'Mismatch of entities in the document: ' . $destinationName; } } $this->progress->finish(); return $this->checkForErrors(); }
/** * {@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(); }
/** * @return bool */ public function perform() { $sourceDocuments = $this->source->getDocumentList(); $this->progressBar->start(count($sourceDocuments)); foreach ($sourceDocuments as $sourceDocName) { $this->progressBar->advance(); $destinationName = $this->map->getDocumentMap($sourceDocName, MapInterface::TYPE_SOURCE); if (!$destinationName) { continue; } $sourceCount = $this->source->getRecordsCount($sourceDocName); $destinationCount = $this->destination->getRecordsCount($destinationName); if ($sourceCount != $destinationCount) { $this->errors[] = 'Mismatch of entities in the document: ' . $destinationName; } } $this->progressBar->finish(); return $this->checkForErrors(); }
/** * Entry point. Run migration of SalesOrder structure. * @return bool */ public function perform() { $this->progress->start($this->getIterationsCount(), LogManager::LOG_LEVEL_INFO); $sourceDocuments = array_keys($this->helper->getDocumentList()); foreach ($sourceDocuments as $sourceDocName) { $sourceDocument = $this->source->getDocument($sourceDocName); $destinationDocumentName = $this->map->getDocumentMap($sourceDocName, MapInterface::TYPE_SOURCE); if (!$destinationDocumentName) { continue; } $destDocument = $this->destination->getDocument($destinationDocumentName); $this->destination->clearDocument($destinationDocumentName); $eavDocumentName = $this->helper->getDestEavDocument(); $eavDocumentResource = $this->destination->getDocument($eavDocumentName); /** @var \Migration\RecordTransformer $recordTransformer */ $recordTransformer = $this->recordTransformerFactory->create(['sourceDocument' => $sourceDocument, 'destDocument' => $destDocument, 'mapReader' => $this->map]); $recordTransformer->init(); $pageNumber = 0; $this->logger->debug('migrating', ['table' => $sourceDocName]); $this->progress->start($this->source->getRecordsCount($sourceDocName), LogManager::LOG_LEVEL_DEBUG); while (!empty($bulk = $this->source->getRecords($sourceDocName, $pageNumber))) { $pageNumber++; $destinationCollection = $destDocument->getRecords(); $destEavCollection = $eavDocumentResource->getRecords(); foreach ($bulk as $recordData) { $this->progress->advance(LogManager::LOG_LEVEL_INFO); $this->progress->advance(LogManager::LOG_LEVEL_DEBUG); /** @var Record $sourceRecord */ $sourceRecord = $this->recordFactory->create(['document' => $sourceDocument, 'data' => $recordData]); /** @var Record $destRecord */ $destRecord = $this->recordFactory->create(['document' => $destDocument]); $recordTransformer->transform($sourceRecord, $destRecord); $destinationCollection->addRecord($destRecord); $this->migrateAdditionalOrderData($recordData, $sourceDocument, $destEavCollection); } $this->destination->saveRecords($destinationDocumentName, $destinationCollection); $this->destination->saveRecords($eavDocumentName, $destEavCollection); $this->progress->finish(LogManager::LOG_LEVEL_DEBUG); } } $this->progress->finish(LogManager::LOG_LEVEL_INFO); return true; }
/** * Volume check * * @return bool */ public function perform() { $sourceDocuments = array_keys($this->groups->getGroup('source_documents')); $this->progress->start(count($sourceDocuments)); foreach ($sourceDocuments as $sourceName) { $this->progress->advance(); $destinationName = $this->map->getDocumentMap($sourceName, MapInterface::TYPE_SOURCE); $sourceFields = $this->source->getDocument($sourceName)->getStructure()->getFields(); $destinationFields = $this->destination->getDocument($destinationName)->getStructure()->getFields(); if (!empty(array_diff_key($sourceFields, $destinationFields))) { $this->errors[] = 'Mismatch of fields in the document: ' . $destinationName; } if ($this->source->getRecordsCount($sourceName) != $this->destination->getRecordsCount($destinationName)) { $this->errors[] = 'Mismatch of entities in the document: ' . $destinationName; } } $this->progress->finish(); return $this->checkForErrors(); }
/** * Entry point. Run migration of EAV structure. * @return bool */ public function perform() { $this->progress->start($this->getIterationsCount()); $this->initialData->init(); $this->migrateAttributeSetsAndGroups(); $this->migrateAttributes(); $this->migrateEntityAttributes(); $this->migrateMappedTables(); $this->progress->finish(); return true; }
/** * @return bool */ public function perform() { $this->progressBar->start(1); $this->progressBar->advance(); /** @var \Magento\Framework\DB\Adapter\Pdo\Mysql $adapter */ $adapter = $this->destination->getAdapter()->getSelect()->getAdapter(); foreach ($this->helper->getEntityTypeTablesMap() as $entityType) { foreach ($this->helper->getStoreIds() as $storeId) { $incrementMaxNumber = $this->helper->getMaxIncrementForEntityType($entityType['entity_type_id']); $select = $adapter->select()->from($this->helper->getTableName($entityType['entity_type_table'], $storeId))->order("{$entityType['column']} DESC")->limit(1); $lastInsertId = $adapter->fetchOne($select); if ($incrementMaxNumber != $lastInsertId) { $this->errors[] = sprintf('Mismatch in last increment id of %s entity', $entityType['entity_type_code']); continue 2; } } } $this->progressBar->finish(); return $this->checkForErrors(); }
/** * {@inheritdoc} */ public function perform() { $this->progress->start(1); $this->progress->advance(); $ratingsIsActive = []; /** @var \Migration\ResourceModel\Adapter\Mysql $adapter */ $adapter = $this->destination->getAdapter(); /** @var \Magento\Framework\DB\Select $select */ $select = $adapter->getSelect()->from($this->getRatingStoreDocument(), ['rating_id'])->where('store_id > 0'); $ratingsStore = $adapter->loadDataFromSelect($select); foreach ($ratingsStore as $rating) { $ratingsIsActive[] = $rating['rating_id']; } $ratingsIsActive = array_unique($ratingsIsActive); if ($ratingsIsActive) { $adapter->updateDocument($this->getRatingDocument(), ['is_active' => 1], sprintf('rating_id IN (%s)', implode(',', $ratingsIsActive))); } $this->progress->finish(); return true; }
/** * {@inheritdoc} */ protected function volume() { $this->progress->start(1); $this->getRewritesSelect(); $this->progress->advance(); $result = $this->source->getRecordsCount($this->tableName) == $this->destination->getRecordsCount('url_rewrite'); if (!$result) { $this->logger->error('Mismatch of entities in the document: url_rewrite'); } $this->progress->finish(); return $result; }