1 | <?php |
||
22 | class InitialSyncCommand extends ContainerAwareCommand |
||
23 | { |
||
24 | const COMMAND_NAME = 'oro:magento:initial:sync'; |
||
25 | |||
26 | const SYNC_PROCESSOR = 'orocrm_magento.provider.initial_sync_processor'; |
||
27 | |||
28 | const STATUS_SUCCESS = 0; |
||
29 | const STATUS_FAILED = 255; |
||
30 | |||
31 | /** |
||
32 | * List of listeners what will be disabled during sync |
||
33 | */ |
||
34 | protected $disabledOptionalListeners = [ |
||
35 | 'oro_search.index_listener', |
||
36 | 'oro_entity.event_listener.entity_modify_created_updated_properties_listener' |
||
37 | ]; |
||
38 | |||
39 | /** |
||
40 | * List of entities we need to reindex after sync |
||
41 | */ |
||
42 | protected $indexedEntities = [ |
||
43 | 'OroCRM\Bundle\MagentoBundle\Entity\Order', |
||
44 | 'OroCRM\Bundle\MagentoBundle\Entity\Cart', |
||
45 | 'OroCRM\Bundle\MagentoBundle\Entity\Customer' |
||
46 | ]; |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function configure() |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public function execute(InputInterface $input, OutputInterface $output) |
||
129 | |||
130 | /** |
||
131 | * @param OutputInterface $output |
||
132 | * @return OutputLogger |
||
133 | */ |
||
134 | protected function getLogger(OutputInterface $output) |
||
142 | |||
143 | /** |
||
144 | * Check is job running (from previous schedule) |
||
145 | * |
||
146 | * @param null|int $integrationId |
||
147 | * |
||
148 | * @return bool |
||
149 | */ |
||
150 | protected function isJobRunning($integrationId) |
||
157 | |||
158 | protected function initEntityManager() |
||
162 | |||
163 | /** |
||
164 | * @return EntityManager |
||
165 | */ |
||
166 | protected function getEntityManager() |
||
170 | |||
171 | /** |
||
172 | * @param LoggerInterface $logger |
||
173 | * @return InitialSyncProcessor |
||
174 | */ |
||
175 | protected function getSyncProcessor($logger) |
||
182 | |||
183 | /** |
||
184 | * @return ChannelRepository |
||
185 | */ |
||
186 | protected function getIntegrationChannelRepository() |
||
190 | |||
191 | /** |
||
192 | * Get service from DI container by id |
||
193 | * |
||
194 | * @param string $id |
||
195 | * |
||
196 | * @return object |
||
197 | */ |
||
198 | protected function getService($id) |
||
202 | |||
203 | /** |
||
204 | * @param Integration $integration |
||
205 | */ |
||
206 | protected function scheduleAnalyticRecalculation(Integration $integration) |
||
213 | |||
214 | /** |
||
215 | * @param Integration $integration |
||
216 | * @return Channel |
||
217 | */ |
||
218 | protected function getDataChannelByChannel(Integration $integration) |
||
224 | |||
225 | /** |
||
226 | * Turn off listeners to increase the performance |
||
227 | */ |
||
228 | protected function disableOptionalListeners() |
||
238 | |||
239 | /** |
||
240 | * Updates the search index for magento entities |
||
241 | */ |
||
242 | protected function runReindex() |
||
246 | |||
247 | /** |
||
248 | * @return \Oro\Bundle\SearchBundle\Async\Indexer |
||
249 | */ |
||
250 | protected function getSearchIndexer() |
||
254 | } |
||
255 |