16
16
use Migration \App \ProgressBar ;
17
17
use Migration \Logger \Manager as LogManager ;
18
18
use Migration \Logger \Logger ;
19
+ use Migration \RecordTransformer ;
19
20
20
21
/**
21
22
* Class Data
@@ -114,7 +115,15 @@ public function perform()
114
115
}
115
116
$ destDocument = $ this ->destination ->getDocument ($ destinationName );
116
117
$ 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 ();
118
127
$ pageNumber = 0 ;
119
128
$ this ->logger ->debug ('migrating ' , ['table ' => $ sourceDocName ]);
120
129
$ this ->progress ->start ($ this ->source ->getRecordsCount ($ sourceDocName ), LogManager::LOG_LEVEL_DEBUG );
@@ -127,11 +136,11 @@ public function perform()
127
136
$ destinationRecords = $ destDocument ->getRecords ();
128
137
foreach ($ bulk as $ recordData ) {
129
138
$ this ->progress ->advance (LogManager::LOG_LEVEL_DEBUG );
139
+ /** @var Record $record */
140
+ $ record = $ this ->recordFactory ->create (['document ' => $ sourceDocument , 'data ' => $ recordData ]);
130
141
/** @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 );
135
144
$ destinationRecords ->addRecord ($ destRecord );
136
145
}
137
146
$ this ->destination ->saveRecords ($ destinationName , $ destinationRecords );
@@ -175,6 +184,7 @@ public function getLogDataSelect()
175
184
'customer_id ' => 'lc.customer_id ' ,
176
185
'session_id ' => 'lv.session_id ' ,
177
186
'last_visit_at ' => 'lv.last_visit_at ' ,
187
+ 'first_visit_at ' => 'lv.first_visit_at ' ,
178
188
];
179
189
/** @var \Magento\Framework\DB\Select $select */
180
190
$ select = $ this ->sourceAdapter ->getSelect ();
@@ -186,7 +196,7 @@ public function getLogDataSelect()
186
196
)
187
197
->group ('lv.visitor_id ' )
188
198
->order ('lv.visitor_id ' );
189
-
199
+
190
200
return $ select ;
191
201
}
192
202
0 commit comments