1 | <?php |
||
14 | class TwoWaySyncStrategy implements TwoWaySyncStrategyInterface |
||
15 | { |
||
16 | /** @var array */ |
||
17 | protected $supportedStrategies = [ |
||
18 | TwoWaySyncConnectorInterface::REMOTE_WINS, |
||
19 | TwoWaySyncConnectorInterface::LOCAL_WINS |
||
20 | ]; |
||
21 | |||
22 | /** @var StepExecutionAwareImportProcessor */ |
||
23 | protected $importProcessor; |
||
24 | |||
25 | /** @var StepExecutionAwareExportProcessor */ |
||
26 | protected $exportProcessor; |
||
27 | |||
28 | /** @var DoctrineHelper */ |
||
29 | protected $doctrineHelper; |
||
30 | |||
31 | /** @var object|null */ |
||
32 | protected $normalizedObject; |
||
33 | |||
34 | /** |
||
35 | * @param StepExecutionAwareImportProcessor $importProcessor |
||
36 | * @param StepExecutionAwareExportProcessor $exportProcessor |
||
37 | * @param DoctrineHelper $doctrineHelper |
||
38 | */ |
||
39 | public function __construct( |
||
48 | |||
49 | /** |
||
50 | * @param StepExecution $stepExecution |
||
51 | */ |
||
52 | public function setStepExecution(StepExecution $stepExecution) |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function merge( |
||
115 | |||
116 | /** |
||
117 | * @param array $baseData |
||
118 | * @param array $newData |
||
119 | * @return array |
||
120 | */ |
||
121 | protected function getDiff(array $baseData, array $newData) |
||
142 | |||
143 | /** |
||
144 | * @param array $localData |
||
145 | * @param array $oldValues |
||
146 | * @return array |
||
147 | */ |
||
148 | protected function getSnapshot(array $localData, array $oldValues) |
||
160 | |||
161 | /** |
||
162 | * @param array $data |
||
163 | * @return array |
||
164 | */ |
||
165 | protected function normalize(array $data) |
||
171 | |||
172 | /** |
||
173 | * Since object normalization does unwanted changes to the object, |
||
174 | * it's necessary to revert it into original value |
||
175 | * |
||
176 | * This can be reproduced by refreshing page after changing magento customer address (e.g. first name) |
||
177 | * with enabled 2 way sync. |
||
178 | */ |
||
179 | protected function refreshNormalizedObject() |
||
189 | |||
190 | /** |
||
191 | * @param array $oldValues |
||
192 | * @param array $newValues |
||
193 | * @return array |
||
194 | */ |
||
195 | protected function fillEmptyValues(array $oldValues, array $newValues) |
||
206 | |||
207 | /** |
||
208 | * @param array $changeSet |
||
209 | * @param string $key |
||
210 | * @return array |
||
211 | */ |
||
212 | protected function getChangeSetValues($changeSet, $key) |
||
227 | } |
||
228 |