/** * Process errors * * @return bool */ protected function checkForErrors() { foreach ($this->errors as $error) { $this->logger->warning($error); } return empty($this->errors); }
/** * @return bool */ protected function volume() { $result = true; $this->progress->start(1); $this->progress->advance(); $ratingsShouldBeActive = []; $ratingsIsActive = []; /** @var \Migration\Resource\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->logger->warning(sprintf('Mismatch of entities in the documents: %s, %s', self::RATING_TABLE_NAME, self::RATING_STORE_TABLE_NAME)); $result = false; } $this->progress->finish(); return $result; }
/** * Volume check * * @return bool */ protected function volume() { $result = true; $this->progress->start(1); $result &= $this->source->getRecordsCount(self::SOURCE) == $this->destination->getRecordsCount(self::DESTINATION); if (!$result) { $this->logger->warning('Mismatch of entities in the document: url_rewrite'); } $this->progress->advance(); $this->progress->finish(); return (bool) $result; }
/** * @return bool */ public function checkMismatchDocumentFieldDataTypes() { if (isset($this->mismatchDocumentFieldDataTypes[MapInterface::TYPE_SOURCE])) { foreach ($this->mismatchDocumentFieldDataTypes[MapInterface::TYPE_SOURCE] as $document => $fields) { $this->logger->warning(sprintf('Mismatch of data types. Source document: %s. Fields: %s', $document, implode(',', $fields))); } } if (isset($this->mismatchDocumentFieldDataTypes[MapInterface::TYPE_DEST])) { foreach ($this->mismatchDocumentFieldDataTypes[MapInterface::TYPE_DEST] as $document => $fields) { $this->logger->warning(sprintf('Mismatch of data types. Destination document: %s. Fields: %s', $document, implode(',', $fields))); } } return true; }
/** * Volume check * * @return bool */ protected function volume() { $result = true; $this->progress->start(count($this->getDocumentList())); foreach ($this->getDocumentList() as $sourceName => $destinationName) { $this->progress->advance(); if ($this->source->getRecordsCount($sourceName) != $this->destination->getRecordsCount($destinationName)) { $this->logger->warning('Mismatch of entities in the document: ' . $destinationName); $result = false; } } $this->progress->finish(); return $result; }