Skip to content

Commit 337fcc6

Browse files
committed
ACP2E-730: Customer module have new table fields which causes error during migration
1 parent 649674f commit 337fcc6

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/Migration/Step/Log/Data.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Migration\App\ProgressBar;
1717
use Migration\Logger\Manager as LogManager;
1818
use Migration\Logger\Logger;
19+
use Migration\RecordTransformer;
1920

2021
/**
2122
* Class Data
@@ -114,7 +115,15 @@ public function perform()
114115
}
115116
$destDocument = $this->destination->getDocument($destinationName);
116117
$this->destination->clearDocument($destinationName);
117-
118+
/** @var RecordTransformer $recordTransformer */
119+
$recordTransformer = $this->recordTransformerFactory->create(
120+
[
121+
'sourceDocument' => $sourceDocument,
122+
'destDocument' => $destDocument,
123+
'mapReader' => $this->map
124+
]
125+
);
126+
$recordTransformer->init();
118127
$pageNumber = 0;
119128
$this->logger->debug('migrating', ['table' => $sourceDocName]);
120129
$this->progress->start($this->source->getRecordsCount($sourceDocName), LogManager::LOG_LEVEL_DEBUG);
@@ -127,11 +136,11 @@ public function perform()
127136
$destinationRecords = $destDocument->getRecords();
128137
foreach ($bulk as $recordData) {
129138
$this->progress->advance(LogManager::LOG_LEVEL_DEBUG);
139+
/** @var Record $record */
140+
$record = $this->recordFactory->create(['document' => $sourceDocument, 'data' => $recordData]);
130141
/** @var Record $destRecord */
131-
$destRecord = $this->recordFactory->create([
132-
'document' => $destDocument,
133-
'data' => $recordData,
134-
]);
142+
$destRecord = $this->recordFactory->create(['document' => $destDocument]);
143+
$recordTransformer->transform($record, $destRecord);
135144
$destinationRecords->addRecord($destRecord);
136145
}
137146
$this->destination->saveRecords($destinationName, $destinationRecords);
@@ -175,6 +184,7 @@ public function getLogDataSelect()
175184
'customer_id' => 'lc.customer_id',
176185
'session_id' => 'lv.session_id',
177186
'last_visit_at' => 'lv.last_visit_at',
187+
'first_visit_at' => 'lv.first_visit_at',
178188
];
179189
/** @var \Magento\Framework\DB\Select $select */
180190
$select = $this->sourceAdapter->getSelect();
@@ -186,7 +196,7 @@ public function getLogDataSelect()
186196
)
187197
->group('lv.visitor_id')
188198
->order('lv.visitor_id');
189-
199+
190200
return $select;
191201
}
192202

0 commit comments

Comments
 (0)