コード例 #1
0
 /**
  * {@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;
 }
コード例 #2
0
 /**
  * {@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);
 }
コード例 #3
0
 /**
  * {@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;
 }