/** * @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; }
/** * Get iterations count for step * * @return int */ protected function getIterationsCount() { return count($this->helper->getDocumentList()); }
/** * @inheritdoc */ public function getDocumentList() { $documentList = parent::getDocumentList(); $documentListArchive = ['enterprise_sales_order_grid_archive' => 'magento_sales_order_grid_archive', 'enterprise_sales_invoice_grid_archive' => 'magento_sales_invoice_grid_archive', 'enterprise_sales_shipment_grid_archive' => 'magento_sales_shipment_grid_archive', 'enterprise_sales_creditmemo_grid_archive' => 'magento_sales_creditmemo_grid_archive']; return array_merge($documentList, $documentListArchive); }