Total Complexity | 153 |
Total Lines | 1706 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like DataImportBusinessFactory often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use DataImportBusinessFactory, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
135 | class DataImportBusinessFactory extends SprykerDataImportBusinessFactory |
||
136 | { |
||
137 | /** |
||
138 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
139 | * |
||
140 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface|null |
||
141 | */ |
||
142 | public function getDataImporterByType(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): ?DataImporterInterface |
||
143 | { |
||
144 | switch ($dataImportConfigurationActionTransfer->getDataEntity()) { |
||
145 | case DataImportConfig::IMPORT_TYPE_CURRENCY: |
||
146 | return $this->createCurrencyImporter($dataImportConfigurationActionTransfer); |
||
147 | case DataImportConfig::IMPORT_TYPE_CATEGORY_TEMPLATE: |
||
148 | return $this->createCategoryTemplateImporter($dataImportConfigurationActionTransfer); |
||
149 | case DataImportConfig::IMPORT_TYPE_CUSTOMER: |
||
150 | return $this->createCustomerImporter($dataImportConfigurationActionTransfer); |
||
151 | case DataImportConfig::IMPORT_TYPE_GLOSSARY: |
||
152 | return $this->createGlossaryImporter($dataImportConfigurationActionTransfer); |
||
153 | case DataImportConfig::IMPORT_TYPE_TAX: |
||
154 | return $this->createTaxImporter($dataImportConfigurationActionTransfer); |
||
155 | case DataImportConfig::IMPORT_TYPE_DISCOUNT: |
||
156 | return $this->createDiscountImporter($dataImportConfigurationActionTransfer); |
||
157 | case DataImportConfig::IMPORT_TYPE_DISCOUNT_STORE: |
||
158 | return $this->createDiscountStoreImporter($dataImportConfigurationActionTransfer); |
||
159 | case DataImportConfig::IMPORT_TYPE_DISCOUNT_VOUCHER: |
||
160 | return $this->createDiscountVoucherImporter($dataImportConfigurationActionTransfer); |
||
161 | case DataImportConfig::IMPORT_TYPE_PRODUCT_ATTRIBUTE_KEY: |
||
162 | return $this->createProductAttributeKeyImporter($dataImportConfigurationActionTransfer); |
||
163 | case DataImportConfig::IMPORT_TYPE_PRODUCT_MANAGEMENT_ATTRIBUTE: |
||
164 | return $this->createProductManagementAttributeImporter($dataImportConfigurationActionTransfer); |
||
165 | case DataImportConfig::IMPORT_TYPE_PRODUCT_ABSTRACT: |
||
166 | return $this->createProductAbstractImporter($dataImportConfigurationActionTransfer); |
||
167 | case DataImportConfig::IMPORT_TYPE_PRODUCT_ABSTRACT_STORE: |
||
168 | return $this->createProductAbstractStoreImporter($dataImportConfigurationActionTransfer); |
||
169 | case DataImportConfig::IMPORT_TYPE_PRODUCT_CONCRETE: |
||
170 | return $this->createProductConcreteImporter($dataImportConfigurationActionTransfer); |
||
171 | case DataImportConfig::IMPORT_TYPE_PRODUCT_IMAGE: |
||
172 | return $this->createProductImageImporter($dataImportConfigurationActionTransfer); |
||
173 | case DataImportConfig::IMPORT_TYPE_PRODUCT_OPTION: |
||
174 | return $this->createProductOptionImporter($dataImportConfigurationActionTransfer); |
||
175 | case DataImportConfig::IMPORT_TYPE_PRODUCT_OPTION_PRICE: |
||
176 | return $this->createProductOptionPriceImporter($dataImportConfigurationActionTransfer); |
||
177 | case DataImportConfig::IMPORT_TYPE_PRODUCT_GROUP: |
||
178 | return $this->createProductGroupImporter($dataImportConfigurationActionTransfer); |
||
179 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_ABSTRACT: |
||
180 | return $this->createCombinedProductAbstractImporter($dataImportConfigurationActionTransfer); |
||
181 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_ABSTRACT_STORE: |
||
182 | return $this->createCombinedProductAbstractStoreImporter($dataImportConfigurationActionTransfer); |
||
183 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_CONCRETE: |
||
184 | return $this->createCombinedProductConcreteImporter($dataImportConfigurationActionTransfer); |
||
185 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_IMAGE: |
||
186 | return $this->createCombinedProductImageImporter($dataImportConfigurationActionTransfer); |
||
187 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_PRICE: |
||
188 | return $this->createCombinedProductPriceImporter($dataImportConfigurationActionTransfer); |
||
189 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_STOCK: |
||
190 | return $this->createCombinedProductStockImporter($dataImportConfigurationActionTransfer); |
||
191 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_GROUP: |
||
192 | return $this->createCombinedProductGroupImporter($dataImportConfigurationActionTransfer); |
||
193 | case DataImportConfig::IMPORT_TYPE_PRODUCT_REVIEW: |
||
194 | return $this->createProductReviewImporter($dataImportConfigurationActionTransfer); |
||
195 | case DataImportConfig::IMPORT_TYPE_PRODUCT_SET: |
||
196 | return $this->createProductSetImporter($dataImportConfigurationActionTransfer); |
||
197 | case DataImportConfig::IMPORT_TYPE_PRODUCT_SEARCH_ATTRIBUTE_MAP: |
||
198 | return $this->createProductSearchAttributeMapImporter($dataImportConfigurationActionTransfer); |
||
199 | case DataImportConfig::IMPORT_TYPE_PRODUCT_SEARCH_ATTRIBUTE: |
||
200 | return $this->createProductSearchAttributeImporter($dataImportConfigurationActionTransfer); |
||
201 | case DataImportConfig::IMPORT_TYPE_CMS_TEMPLATE: |
||
202 | return $this->createCmsTemplateImporter($dataImportConfigurationActionTransfer); |
||
203 | case DataImportConfig::IMPORT_TYPE_CMS_BLOCK: |
||
204 | return $this->createCmsBlockImporter($dataImportConfigurationActionTransfer); |
||
205 | case DataImportConfig::IMPORT_TYPE_CMS_BLOCK_STORE: |
||
206 | return $this->createCmsBlockStoreImporter($dataImportConfigurationActionTransfer); |
||
207 | case DataImportConfig::IMPORT_TYPE_DISCOUNT_AMOUNT: |
||
208 | return $this->createDiscountAmountImporter($dataImportConfigurationActionTransfer); |
||
209 | case DataImportConfig::IMPORT_TYPE_ABSTRACT_GIFT_CARD_CONFIGURATION: |
||
210 | return $this->createAbstractGiftCardConfigurationImporter($dataImportConfigurationActionTransfer); |
||
211 | case DataImportConfig::IMPORT_TYPE_CONCRETE_GIFT_CARD_CONFIGURATION: |
||
212 | return $this->createConcreteGiftCardConfigurationImporter($dataImportConfigurationActionTransfer); |
||
213 | case DataImportConfig::IMPORT_TYPE_PRODUCT_STOCK: |
||
214 | return $this->createProductStockImporter($dataImportConfigurationActionTransfer); |
||
215 | case DataImportConfig::IMPORT_TYPE_NAVIGATION: |
||
216 | return $this->createNavigationImporter($dataImportConfigurationActionTransfer); |
||
217 | case DataImportConfig::IMPORT_TYPE_NAVIGATION_NODE: |
||
218 | return $this->createNavigationNodeImporter($dataImportConfigurationActionTransfer); |
||
219 | default: |
||
220 | return null; |
||
221 | } |
||
222 | } |
||
223 | |||
224 | /** |
||
225 | * @param string $importType |
||
226 | * @param \Spryker\Zed\DataImport\Business\Model\DataReader\DataReaderInterface $reader |
||
227 | * |
||
228 | * @return \Pyz\Zed\DataImport\Business\Model\DataImporterConditional |
||
229 | */ |
||
230 | public function createDataImporterConditional(string $importType, DataReaderInterface $reader): DataImporterConditional |
||
231 | { |
||
232 | return new DataImporterConditional($importType, $reader, $this->getGracefulRunnerFacade()); |
||
233 | } |
||
234 | |||
235 | /** |
||
236 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
237 | * |
||
238 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
239 | */ |
||
240 | protected function createCurrencyImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
241 | { |
||
242 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
243 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
244 | ); |
||
245 | |||
246 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
247 | $dataSetStepBroker->addStep(new CurrencyWriterStep()); |
||
248 | |||
249 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
250 | |||
251 | return $dataImporter; |
||
252 | } |
||
253 | |||
254 | /** |
||
255 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
256 | * |
||
257 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
258 | */ |
||
259 | protected function createGlossaryImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
260 | { |
||
261 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
262 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
263 | ); |
||
264 | |||
265 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(GlossaryWriterStep::BULK_SIZE); |
||
266 | $dataSetStepBroker |
||
267 | ->addStep($this->createLocaleNameToIdStep(GlossaryWriterStep::KEY_LOCALE)) |
||
268 | ->addStep(new GlossaryWriterStep()); |
||
269 | |||
270 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
271 | |||
272 | return $dataImporter; |
||
273 | } |
||
274 | |||
275 | /** |
||
276 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
277 | * |
||
278 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
279 | */ |
||
280 | protected function createCategoryTemplateImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
281 | { |
||
282 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
283 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
284 | ); |
||
285 | |||
286 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
287 | $dataSetStepBroker |
||
288 | ->addStep(new CategoryTemplateWriterStep()); |
||
289 | |||
290 | $dataImporter |
||
291 | ->addDataSetStepBroker($dataSetStepBroker); |
||
292 | |||
293 | return $dataImporter; |
||
294 | } |
||
295 | |||
296 | /** |
||
297 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
298 | * |
||
299 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
300 | */ |
||
301 | protected function createCustomerImporter( |
||
302 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
303 | ): DataImporterInterface { |
||
304 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
305 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
306 | ); |
||
307 | |||
308 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
309 | $dataSetStepBroker->addStep(new CustomerWriterStep()); |
||
310 | |||
311 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
312 | |||
313 | return $dataImporter; |
||
314 | } |
||
315 | |||
316 | /** |
||
317 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
318 | * |
||
319 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
320 | */ |
||
321 | protected function createCmsTemplateImporter( |
||
322 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
323 | ): DataImporterInterface { |
||
324 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
325 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
326 | ); |
||
327 | |||
328 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
329 | $dataSetStepBroker |
||
330 | ->addStep(new CmsTemplateWriterStep()); |
||
331 | |||
332 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
333 | |||
334 | return $dataImporter; |
||
335 | } |
||
336 | |||
337 | /** |
||
338 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
339 | * |
||
340 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
341 | */ |
||
342 | protected function createCmsBlockImporter( |
||
343 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
344 | ): DataImporterInterface { |
||
345 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
346 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
347 | ); |
||
348 | |||
349 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CmsBlockWriterStep::BULK_SIZE); |
||
350 | $dataSetStepBroker |
||
351 | ->addStep($this->createAddLocalesStep()) |
||
352 | ->addStep($this->createLocalizedAttributesExtractorStep([ |
||
353 | CmsBlockWriterStep::KEY_PLACEHOLDER_TITLE, |
||
354 | CmsBlockWriterStep::KEY_PLACEHOLDER_DESCRIPTION, |
||
355 | CmsBlockWriterStep::KEY_PLACEHOLDER_CONTENT, |
||
356 | CmsBlockWriterStep::KEY_PLACEHOLDER_LINK, |
||
357 | ])) |
||
358 | ->addStep(new CmsBlockWriterStep()); |
||
359 | |||
360 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
361 | |||
362 | return $dataImporter; |
||
363 | } |
||
364 | |||
365 | /** |
||
366 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
367 | * |
||
368 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
369 | */ |
||
370 | protected function createCmsBlockStoreImporter( |
||
371 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
372 | ): DataImporterInterface { |
||
373 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
374 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
375 | ); |
||
376 | |||
377 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CmsBlockStoreWriterStep::BULK_SIZE); |
||
378 | $dataSetStepBroker->addStep(new CmsBlockStoreWriterStep()); |
||
379 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
380 | |||
381 | return $dataImporter; |
||
382 | } |
||
383 | |||
384 | /** |
||
385 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
386 | * |
||
387 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
388 | */ |
||
389 | protected function createDiscountImporter( |
||
390 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
391 | ): DataImporterInterface { |
||
392 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
393 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
394 | ); |
||
395 | |||
396 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(DiscountWriterStep::BULK_SIZE); |
||
397 | $dataSetStepBroker |
||
398 | ->addStep(new DiscountWriterStep()); |
||
399 | |||
400 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
401 | |||
402 | return $dataImporter; |
||
403 | } |
||
404 | |||
405 | /** |
||
406 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
407 | * |
||
408 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
409 | */ |
||
410 | protected function createDiscountStoreImporter( |
||
411 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
412 | ): DataImporterInterface { |
||
413 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
414 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
415 | ); |
||
416 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(DiscountStoreWriterStep::BULK_SIZE); |
||
417 | $dataSetStepBroker |
||
418 | ->addStep(new DiscountStoreWriterStep()); |
||
419 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
420 | |||
421 | return $dataImporter; |
||
422 | } |
||
423 | |||
424 | /** |
||
425 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
426 | * |
||
427 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
428 | */ |
||
429 | protected function createDiscountAmountImporter( |
||
430 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
431 | ): DataImporterInterface { |
||
432 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
433 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
434 | ); |
||
435 | |||
436 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(DiscountAmountWriterStep::BULK_SIZE); |
||
437 | $dataSetStepBroker |
||
438 | ->addStep(new DiscountAmountWriterStep()); |
||
439 | |||
440 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
441 | |||
442 | return $dataImporter; |
||
443 | } |
||
444 | |||
445 | /** |
||
446 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
447 | * |
||
448 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
449 | */ |
||
450 | protected function createDiscountVoucherImporter( |
||
451 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
452 | ): DataImporterInterface { |
||
453 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
454 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
455 | ); |
||
456 | |||
457 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(DiscountVoucherWriterStep::BULK_SIZE); |
||
458 | $dataSetStepBroker |
||
459 | ->addStep(new DiscountVoucherWriterStep($this->createDiscountConfig())); |
||
460 | |||
461 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
462 | |||
463 | return $dataImporter; |
||
464 | } |
||
465 | |||
466 | /** |
||
467 | * @return \Spryker\Zed\Discount\DiscountConfig |
||
468 | */ |
||
469 | protected function createDiscountConfig(): DiscountConfig |
||
470 | { |
||
471 | return new DiscountConfig(); |
||
472 | } |
||
473 | |||
474 | /** |
||
475 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
476 | * |
||
477 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
478 | */ |
||
479 | protected function createProductOptionImporter( |
||
480 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
481 | ): DataImporterInterface { |
||
482 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
483 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
484 | ); |
||
485 | |||
486 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
487 | $dataSetStepBroker |
||
488 | ->addStep($this->createAddLocalesStep()) |
||
489 | ->addStep($this->createTaxSetNameToIdTaxSetStep(ProductOptionWriterStep::KEY_TAX_SET_NAME)) |
||
490 | ->addStep($this->createLocalizedAttributesExtractorStep([ |
||
491 | ProductOptionWriterStep::KEY_GROUP_NAME, |
||
492 | ProductOptionWriterStep::KEY_OPTION_NAME, |
||
493 | ])) |
||
494 | ->addStep(new ProductOptionWriterStep()); |
||
495 | |||
496 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
497 | |||
498 | return $dataImporter; |
||
499 | } |
||
500 | |||
501 | /** |
||
502 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
503 | * |
||
504 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
505 | */ |
||
506 | protected function createProductOptionPriceImporter( |
||
507 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
508 | ): DataImporterInterface { |
||
509 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
510 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
511 | ); |
||
512 | |||
513 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
514 | $dataSetStepBroker |
||
515 | ->addStep(new ProductOptionPriceWriterStep()); |
||
516 | |||
517 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
518 | |||
519 | return $dataImporter; |
||
520 | } |
||
521 | |||
522 | /** |
||
523 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
524 | * |
||
525 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
526 | */ |
||
527 | public function createProductStockImporter( |
||
528 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
529 | ): DataImporterInterface { |
||
530 | /** @phpstan-var \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface&\Spryker\Zed\DataImport\Business\Model\DataImporterInterface&\Spryker\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareInterface $dataImporter */ |
||
531 | $dataImporter = $this->getCsvDataImporterWriterAwareFromConfig( |
||
532 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
533 | ); |
||
534 | |||
535 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductStockHydratorStep::BULK_SIZE); |
||
536 | $dataSetStepBroker |
||
537 | ->addStep(new ProductStockHydratorStep()); |
||
538 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
539 | $dataImporter->setDataSetWriter($this->createProductStockDataImportWriters()); |
||
540 | |||
541 | return $dataImporter; |
||
542 | } |
||
543 | |||
544 | /** |
||
545 | * @return \Pyz\Zed\DataImport\Business\Model\ProductStock\Hook\ProductStockAfterImportPublishHook |
||
546 | */ |
||
547 | protected function createProductStockAfterImportPublishHook(): ProductStockAfterImportPublishHook |
||
548 | { |
||
549 | return new ProductStockAfterImportPublishHook(); |
||
550 | } |
||
551 | |||
552 | /** |
||
553 | * @return \Spryker\Zed\Availability\Business\AvailabilityFacadeInterface |
||
554 | */ |
||
555 | protected function getAvailabilityFacade(): AvailabilityFacadeInterface |
||
556 | { |
||
557 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_AVAILABILITY); |
||
558 | } |
||
559 | |||
560 | /** |
||
561 | * @return \Spryker\Zed\ProductBundle\Business\ProductBundleFacadeInterface |
||
562 | */ |
||
563 | protected function getProductBundleFacade(): ProductBundleFacadeInterface |
||
564 | { |
||
565 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_PRODUCT_BUNDLE); |
||
566 | } |
||
567 | |||
568 | /** |
||
569 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
570 | * |
||
571 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
572 | */ |
||
573 | public function createProductImageImporter( |
||
574 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
575 | ): DataImporterInterface { |
||
576 | /** @phpstan-var \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface&\Spryker\Zed\DataImport\Business\Model\DataImporterInterface&\Spryker\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareInterface $dataImporter */ |
||
577 | $dataImporter = $this->getCsvDataImporterWriterAwareFromConfig( |
||
578 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
579 | ); |
||
580 | |||
581 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductImageHydratorStep::BULK_SIZE); |
||
582 | $dataSetStepBroker |
||
583 | ->addStep($this->createProductAbstractSkuToIdProductAbstractStep(ProductImageHydratorStep::COLUMN_ABSTRACT_SKU, ProductImageHydratorStep::KEY_IMAGE_SET_FK_PRODUCT_ABSTRACT)) |
||
584 | ->addStep($this->createProductSkuToIdProductStep(ProductImageHydratorStep::COLUMN_CONCRETE_SKU, ProductImageHydratorStep::KEY_IMAGE_SET_FK_PRODUCT)) |
||
585 | ->addStep($this->createLocaleNameToIdStep(ProductImageHydratorStep::COLUMN_LOCALE, ProductImageHydratorStep::KEY_IMAGE_SET_FK_LOCALE)) |
||
586 | ->addStep(new ProductImageHydratorStep()); |
||
587 | |||
588 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
589 | $dataImporter->setDataSetWriter($this->createProductImageDataWriters()); |
||
590 | |||
591 | return $dataImporter; |
||
592 | } |
||
593 | |||
594 | /** |
||
595 | * @return \Pyz\Zed\DataImport\Business\Model\Locale\Repository\LocaleRepositoryInterface |
||
596 | */ |
||
597 | protected function createLocaleRepository(): LocaleRepositoryInterface |
||
598 | { |
||
599 | return new LocaleRepository(); |
||
600 | } |
||
601 | |||
602 | /** |
||
603 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
604 | * |
||
605 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
606 | */ |
||
607 | protected function createTaxImporter( |
||
608 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
609 | ): DataImporterInterface { |
||
610 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
611 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
612 | ); |
||
613 | |||
614 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(TaxWriterStep::BULK_SIZE); |
||
615 | $dataSetStepBroker |
||
616 | ->addStep(new TaxWriterStep($this->createCountryRepository())); |
||
617 | |||
618 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
619 | |||
620 | return $dataImporter; |
||
621 | } |
||
622 | |||
623 | /** |
||
624 | * @return \Pyz\Zed\DataImport\Business\Model\Country\Repository\CountryRepositoryInterface |
||
625 | */ |
||
626 | protected function createCountryRepository(): CountryRepositoryInterface |
||
627 | { |
||
628 | return new CountryRepository(); |
||
629 | } |
||
630 | |||
631 | /** |
||
632 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
633 | * |
||
634 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
635 | */ |
||
636 | protected function createNavigationImporter( |
||
637 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
638 | ): DataImporterInterface { |
||
639 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
640 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
641 | ); |
||
642 | |||
643 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(NavigationWriterStep::BULK_SIZE); |
||
644 | $dataSetStepBroker |
||
645 | ->addStep(new NavigationWriterStep()); |
||
646 | |||
647 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
648 | |||
649 | return $dataImporter; |
||
650 | } |
||
651 | |||
652 | /** |
||
653 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
654 | * |
||
655 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
656 | */ |
||
657 | protected function createNavigationNodeImporter( |
||
658 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
659 | ): DataImporterInterface { |
||
660 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
661 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
662 | ); |
||
663 | |||
664 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(NavigationNodeWriterStep::BULK_SIZE); |
||
665 | $dataSetStepBroker |
||
666 | ->addStep($this->createAddLocalesStep()) |
||
667 | ->addStep($this->createNavigationKeyToIdNavigationStep(NavigationNodeWriterStep::KEY_NAVIGATION_KEY)) |
||
668 | ->addStep($this->createLocalizedAttributesExtractorStep([ |
||
669 | NavigationNodeWriterStep::KEY_TITLE, |
||
670 | NavigationNodeWriterStep::KEY_URL, |
||
671 | NavigationNodeWriterStep::KEY_CSS_CLASS, |
||
672 | ])) |
||
673 | ->addStep($this->createNavigationNodeValidityDatesStep(NavigationNodeWriterStep::KEY_VALID_FROM, NavigationNodeWriterStep::KEY_VALID_TO)) |
||
674 | ->addStep(new NavigationNodeWriterStep()); |
||
675 | |||
676 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
677 | |||
678 | return $dataImporter; |
||
679 | } |
||
680 | |||
681 | /** |
||
682 | * @param string $source |
||
683 | * @param string $target |
||
684 | * |
||
685 | * @return \Pyz\Zed\DataImport\Business\Model\Navigation\NavigationKeyToIdNavigationStep |
||
686 | */ |
||
687 | protected function createNavigationKeyToIdNavigationStep( |
||
688 | string $source = NavigationKeyToIdNavigationStep::KEY_SOURCE, |
||
689 | string $target = NavigationKeyToIdNavigationStep::KEY_TARGET, |
||
690 | ): NavigationKeyToIdNavigationStep { |
||
691 | return new NavigationKeyToIdNavigationStep($source, $target); |
||
692 | } |
||
693 | |||
694 | /** |
||
695 | * @param string $keyValidFrom |
||
696 | * @param string $keyValidTo |
||
697 | * |
||
698 | * @return \Pyz\Zed\DataImport\Business\Model\NavigationNode\NavigationNodeValidityDatesStep |
||
699 | */ |
||
700 | protected function createNavigationNodeValidityDatesStep( |
||
701 | string $keyValidFrom, |
||
702 | string $keyValidTo, |
||
703 | ): NavigationNodeValidityDatesStep { |
||
704 | return new NavigationNodeValidityDatesStep($keyValidFrom, $keyValidTo); |
||
705 | } |
||
706 | |||
707 | /** |
||
708 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
709 | * |
||
710 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
711 | */ |
||
712 | public function createProductAbstractImporter( |
||
713 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
714 | ): DataImporterInterface { |
||
715 | /** @phpstan-var \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface&\Spryker\Zed\DataImport\Business\Model\DataImporterInterface&\Spryker\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareInterface $dataImporter */ |
||
716 | $dataImporter = $this->getCsvDataImporterWriterAwareFromConfig( |
||
717 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
718 | ); |
||
719 | |||
720 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductAbstractHydratorStep::BULK_SIZE); |
||
721 | $dataSetStepBroker |
||
722 | ->addStep($this->createProductAbstractCheckExistenceStep()) |
||
723 | ->addStep($this->createAddLocalesStep()) |
||
724 | ->addStep($this->createAddCategoryKeysStep()) |
||
725 | ->addStep($this->createTaxSetNameToIdTaxSetStep(ProductAbstractHydratorStep::COLUMN_TAX_SET_NAME)) |
||
726 | ->addStep($this->createAttributesExtractorStep()) |
||
727 | ->addStep($this->createProductLocalizedAttributesExtractorStep([ |
||
728 | ProductAbstractHydratorStep::COLUMN_NAME, |
||
729 | ProductAbstractHydratorStep::COLUMN_URL, |
||
730 | ProductAbstractHydratorStep::COLUMN_DESCRIPTION, |
||
731 | ProductAbstractHydratorStep::COLUMN_META_TITLE, |
||
732 | ProductAbstractHydratorStep::COLUMN_META_DESCRIPTION, |
||
733 | ProductAbstractHydratorStep::COLUMN_META_KEYWORDS, |
||
734 | ])) |
||
735 | ->addStep(new ProductAbstractHydratorStep()); |
||
736 | |||
737 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
738 | $dataImporter->setDataSetWriter($this->createProductAbstractDataImportWriters()); |
||
739 | |||
740 | return $dataImporter; |
||
741 | } |
||
742 | |||
743 | /** |
||
744 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
745 | * |
||
746 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
747 | */ |
||
748 | public function createProductAbstractStoreImporter( |
||
749 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
750 | ): DataImporterInterface { |
||
751 | /** @phpstan-var \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface&\Spryker\Zed\DataImport\Business\Model\DataImporterInterface&\Spryker\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareInterface $dataImporter */ |
||
752 | $dataImporter = $this->getCsvDataImporterWriterAwareFromConfig( |
||
753 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
754 | ); |
||
755 | |||
756 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductAbstractStoreHydratorStep::BULK_SIZE); |
||
757 | $dataSetStepBroker->addStep(new ProductAbstractStoreHydratorStep()); |
||
758 | |||
759 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
760 | $dataImporter->setDataSetWriter($this->createProductAbstractStoreDataImportWriters()); |
||
761 | |||
762 | return $dataImporter; |
||
763 | } |
||
764 | |||
765 | /** |
||
766 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
767 | * |
||
768 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
769 | */ |
||
770 | public function createProductConcreteImporter( |
||
771 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
772 | ): DataImporterInterface { |
||
773 | /** @phpstan-var \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface&\Spryker\Zed\DataImport\Business\Model\DataImporterInterface&\Spryker\Zed\DataImport\Business\Model\DataImporterBeforeImportAwareInterface&\Spryker\Zed\DataImport\Business\Model\DataImporterAfterImportAwareInterface&\Spryker\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareInterface $dataImporter */ |
||
774 | $dataImporter = $this->getCsvDataImporterWriterAwareFromConfig( |
||
775 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
776 | ); |
||
777 | |||
778 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductConcreteHydratorStep::BULK_SIZE); |
||
779 | $dataSetStepBroker |
||
780 | ->addStep($this->createProductConcreteCheckExistenceStep()) |
||
781 | ->addStep($this->createAddLocalesStep()) |
||
782 | ->addStep($this->createAttributesExtractorStep()) |
||
783 | ->addStep($this->createProductConcreteAttributesUniqueCheckStep()) |
||
784 | ->addStep($this->createProductLocalizedAttributesExtractorStep([ |
||
785 | ProductConcreteHydratorStep::COLUMN_NAME, |
||
786 | ProductConcreteHydratorStep::COLUMN_DESCRIPTION, |
||
787 | ProductConcreteHydratorStep::COLUMN_IS_SEARCHABLE, |
||
788 | ])) |
||
789 | ->addStep(new ProductConcreteHydratorStep( |
||
790 | $this->createProductRepository(), |
||
791 | )); |
||
792 | |||
793 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
794 | $dataImporter->setDataSetWriter($this->createProductConcreteDataImportWriters()); |
||
795 | |||
796 | return $dataImporter; |
||
797 | } |
||
798 | |||
799 | /** |
||
800 | * @return \Spryker\Zed\DataImport\Business\Model\DataImportStep\DataImportStepInterface |
||
801 | */ |
||
802 | public function createProductConcreteAttributesUniqueCheckStep(): DataImportStepInterface |
||
803 | { |
||
804 | return new ProductConcreteAttributesUniqueCheckStep( |
||
805 | $this->createProductRepository(), |
||
806 | $this->getUtilEncodingService(), |
||
807 | $this->getConfig(), |
||
808 | ); |
||
809 | } |
||
810 | |||
811 | /** |
||
812 | * @return \Spryker\Zed\DataImport\Business\Model\DataImportStep\DataImportStepInterface |
||
813 | */ |
||
814 | public function createProductAbstractCheckExistenceStep(): DataImportStepInterface |
||
815 | { |
||
816 | return new ProductAbstractCheckExistenceStep( |
||
817 | $this->createProductRepository(), |
||
818 | ); |
||
819 | } |
||
820 | |||
821 | /** |
||
822 | * @return \Spryker\Zed\DataImport\Business\Model\DataImportStep\DataImportStepInterface |
||
823 | */ |
||
824 | public function createProductConcreteCheckExistenceStep(): DataImportStepInterface |
||
825 | { |
||
826 | return new ProductConcreteCheckExistenceStep( |
||
827 | $this->createProductRepository(), |
||
828 | ); |
||
829 | } |
||
830 | |||
831 | /** |
||
832 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
833 | */ |
||
834 | protected function createProductAbstractDataImportWriters(): DataSetWriterInterface |
||
835 | { |
||
836 | return new DataSetWriterCollection($this->createProductAbstractWriterPlugins()); |
||
837 | } |
||
838 | |||
839 | /** |
||
840 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
841 | */ |
||
842 | protected function createProductAbstractWriterPlugins(): array |
||
843 | { |
||
844 | return [ |
||
845 | new ProductAbstractPropelWriterPlugin(), |
||
846 | ]; |
||
847 | } |
||
848 | |||
849 | /** |
||
850 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
851 | */ |
||
852 | protected function createProductConcreteDataImportWriters(): DataSetWriterInterface |
||
853 | { |
||
854 | return new DataSetWriterCollection($this->createProductConcreteWriterPlugins()); |
||
855 | } |
||
856 | |||
857 | /** |
||
858 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
859 | */ |
||
860 | protected function createProductConcreteWriterPlugins(): array |
||
861 | { |
||
862 | return [ |
||
863 | new ProductConcretePropelWriterPlugin(), |
||
864 | ]; |
||
865 | } |
||
866 | |||
867 | /** |
||
868 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
869 | */ |
||
870 | protected function createProductImageDataWriters(): DataSetWriterInterface |
||
871 | { |
||
872 | return new DataSetWriterCollection($this->createProductImageWriterPlugins()); |
||
873 | } |
||
874 | |||
875 | /** |
||
876 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
877 | */ |
||
878 | protected function createProductImageWriterPlugins(): array |
||
879 | { |
||
880 | return [ |
||
881 | new ProductImagePropelWriterPlugin(), |
||
882 | ]; |
||
883 | } |
||
884 | |||
885 | /** |
||
886 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
887 | */ |
||
888 | protected function createProductStockDataImportWriters(): DataSetWriterInterface |
||
889 | { |
||
890 | return new DataSetWriterCollection($this->createProductStockWriterPlugins()); |
||
891 | } |
||
892 | |||
893 | /** |
||
894 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
895 | */ |
||
896 | protected function createProductStockWriterPlugins(): array |
||
897 | { |
||
898 | return [ |
||
899 | new ProductStockPropelWriterPlugin(), |
||
900 | ]; |
||
901 | } |
||
902 | |||
903 | /** |
||
904 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
905 | */ |
||
906 | protected function createProductAbstractStoreDataImportWriters(): DataSetWriterInterface |
||
907 | { |
||
908 | return new DataSetWriterCollection($this->createProductAbstractStoreWriterPlugins()); |
||
909 | } |
||
910 | |||
911 | /** |
||
912 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
913 | */ |
||
914 | protected function createProductAbstractStoreWriterPlugins(): array |
||
915 | { |
||
916 | return [ |
||
917 | new ProductAbstractStorePropelWriterPlugin(), |
||
918 | ]; |
||
919 | } |
||
920 | |||
921 | /** |
||
922 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
923 | */ |
||
924 | public function createProductAbstractPropelWriter(): DataSetWriterInterface |
||
927 | } |
||
928 | |||
929 | /** |
||
930 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
931 | */ |
||
932 | public function createProductConcretePropelWriter(): DataSetWriterInterface |
||
933 | { |
||
934 | return new ProductConcretePropelDataSetWriter($this->createProductRepository()); |
||
935 | } |
||
936 | |||
937 | /** |
||
938 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
939 | */ |
||
940 | public function createProductImagePropelWriter(): DataSetWriterInterface |
||
943 | } |
||
944 | |||
945 | /** |
||
946 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
947 | */ |
||
948 | public function createProductStockPropelWriter(): DataSetWriterInterface |
||
949 | { |
||
950 | return new ProductStockPropelDataSetWriter( |
||
951 | $this->getProductBundleFacade(), |
||
952 | $this->createProductRepository(), |
||
953 | $this->getStoreFacade(), |
||
954 | $this->getStockFacade(), |
||
955 | ); |
||
956 | } |
||
957 | |||
958 | /** |
||
959 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
960 | */ |
||
961 | public function createProductAbstractStorePropelWriter(): DataSetWriterInterface |
||
962 | { |
||
963 | return new ProductAbstractStorePropelDataSetWriter(); |
||
964 | } |
||
965 | |||
966 | /** |
||
967 | * @return \Pyz\Zed\DataImport\Business\Model\Product\Repository\ProductRepository |
||
968 | */ |
||
969 | protected function createProductRepository(): ProductRepository |
||
972 | } |
||
973 | |||
974 | /** |
||
975 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
976 | * |
||
977 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
978 | */ |
||
979 | protected function createProductAttributeKeyImporter( |
||
980 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
981 | ): DataImporterInterface { |
||
982 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
983 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
984 | ); |
||
985 | |||
986 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
987 | $dataSetStepBroker |
||
988 | ->addStep(new ProductAttributeKeyWriter()); |
||
989 | |||
990 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
991 | |||
992 | return $dataImporter; |
||
993 | } |
||
994 | |||
995 | /** |
||
996 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
997 | * |
||
998 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
999 | */ |
||
1000 | protected function createProductManagementAttributeImporter( |
||
1001 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1002 | ): DataImporterInterface { |
||
1003 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
1004 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1005 | ); |
||
1006 | |||
1007 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
1008 | $dataSetStepBroker |
||
1009 | ->addStep($this->createAddLocalesStep()) |
||
1010 | ->addStep($this->createAddProductAttributeKeysStep()) |
||
1011 | ->addStep($this->createProductManagementLocalizedAttributesExtractorStep()) |
||
1012 | ->addStep(new ProductManagementAttributeWriter()); |
||
1013 | |||
1014 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1015 | |||
1016 | return $dataImporter; |
||
1017 | } |
||
1018 | |||
1019 | /** |
||
1020 | * @return \Pyz\Zed\DataImport\Business\Model\ProductManagementAttribute\ProductManagementLocalizedAttributesExtractorStep |
||
1021 | */ |
||
1022 | protected function createProductManagementLocalizedAttributesExtractorStep(): ProductManagementLocalizedAttributesExtractorStep |
||
1025 | } |
||
1026 | |||
1027 | /** |
||
1028 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1029 | * |
||
1030 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1031 | */ |
||
1032 | protected function createProductGroupImporter( |
||
1033 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1034 | ): DataImporterInterface { |
||
1035 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
1036 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1037 | ); |
||
1038 | |||
1039 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductGroupWriter::BULK_SIZE); |
||
1040 | $dataSetStepBroker |
||
1041 | ->addStep(new ProductGroupWriter( |
||
1042 | $this->createProductRepository(), |
||
1043 | )); |
||
1044 | |||
1045 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1046 | |||
1047 | return $dataImporter; |
||
1048 | } |
||
1049 | |||
1050 | /** |
||
1051 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1052 | * |
||
1053 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1054 | */ |
||
1055 | protected function createAbstractGiftCardConfigurationImporter( |
||
1056 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1057 | ): DataImporterInterface { |
||
1058 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
1059 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1060 | ); |
||
1061 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(GiftCardAbstractConfigurationWriterStep::BULK_SIZE); |
||
1062 | $dataSetStepBroker |
||
1063 | ->addStep(new GiftCardAbstractConfigurationWriterStep($this->createProductRepository())); |
||
1064 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1065 | |||
1066 | return $dataImporter; |
||
1067 | } |
||
1068 | |||
1069 | /** |
||
1070 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1071 | * |
||
1072 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1073 | */ |
||
1074 | protected function createConcreteGiftCardConfigurationImporter( |
||
1075 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1076 | ): DataImporterInterface { |
||
1077 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
1078 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1079 | ); |
||
1080 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(GiftCardConcreteConfigurationWriterStep::BULK_SIZE); |
||
1081 | $dataSetStepBroker |
||
1082 | ->addStep(new GiftCardConcreteConfigurationWriterStep($this->createProductRepository())); |
||
1083 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1084 | |||
1085 | return $dataImporter; |
||
1086 | } |
||
1087 | |||
1088 | /** |
||
1089 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1090 | * |
||
1091 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1092 | */ |
||
1093 | protected function createProductReviewImporter( |
||
1094 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1095 | ): DataImporterInterface { |
||
1096 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
1097 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1098 | ); |
||
1099 | |||
1100 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
1101 | $dataSetStepBroker->addStep(new ProductReviewWriterStep( |
||
1102 | $this->createProductRepository(), |
||
1103 | $this->createLocaleRepository(), |
||
1104 | )); |
||
1105 | |||
1106 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1107 | |||
1108 | return $dataImporter; |
||
1109 | } |
||
1110 | |||
1111 | /** |
||
1112 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1113 | * |
||
1114 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1115 | */ |
||
1116 | protected function createProductSetImporter( |
||
1117 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1118 | ): DataImporterInterface { |
||
1119 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
1120 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1121 | ); |
||
1122 | |||
1123 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
1124 | $dataSetStepBroker |
||
1125 | ->addStep($this->createAddProductAbstractSkusStep()) |
||
1126 | ->addStep($this->createAddLocalesStep()) |
||
1127 | ->addStep($this->createProductSetImageExtractorStep()) |
||
1128 | ->addStep($this->createLocalizedAttributesExtractorStep([ |
||
1129 | ProductSetWriterStep::KEY_NAME, |
||
1130 | ProductSetWriterStep::KEY_URL, |
||
1131 | ProductSetWriterStep::KEY_DESCRIPTION, |
||
1132 | ProductSetWriterStep::KEY_META_TITLE, |
||
1133 | ProductSetWriterStep::KEY_META_DESCRIPTION, |
||
1134 | ProductSetWriterStep::KEY_META_KEYWORDS, |
||
1135 | ])) |
||
1136 | ->addStep(new ProductSetWriterStep( |
||
1137 | $this->createProductRepository(), |
||
1138 | )); |
||
1139 | |||
1140 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1141 | |||
1142 | return $dataImporter; |
||
1143 | } |
||
1144 | |||
1145 | /** |
||
1146 | * @return \Pyz\Zed\DataImport\Business\Model\ProductSet\ProductSetImageExtractorStep |
||
1147 | */ |
||
1148 | protected function createProductSetImageExtractorStep(): ProductSetImageExtractorStep |
||
1149 | { |
||
1150 | return new ProductSetImageExtractorStep(); |
||
1151 | } |
||
1152 | |||
1153 | /** |
||
1154 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1155 | * |
||
1156 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1157 | */ |
||
1158 | protected function createProductSearchAttributeMapImporter( |
||
1159 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1160 | ): DataImporterInterface { |
||
1161 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
1162 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1163 | ); |
||
1164 | |||
1165 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
1166 | $dataSetStepBroker |
||
1167 | ->addStep($this->createAddProductAttributeKeysStep()) |
||
1168 | ->addStep(new ProductSearchAttributeMapWriter()); |
||
1169 | |||
1170 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1171 | |||
1172 | return $dataImporter; |
||
1173 | } |
||
1174 | |||
1175 | /** |
||
1176 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1177 | * |
||
1178 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1179 | */ |
||
1180 | protected function createProductSearchAttributeImporter( |
||
1181 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1182 | ): DataImporterInterface { |
||
1183 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
1184 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1185 | ); |
||
1186 | |||
1187 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
1188 | $dataSetStepBroker |
||
1189 | ->addStep($this->createAddLocalesStep()) |
||
1190 | ->addStep($this->createAddProductAttributeKeysStep()) |
||
1191 | ->addStep($this->createLocalizedAttributesExtractorStep([ProductSearchAttributeWriter::KEY])) |
||
1192 | ->addStep(new ProductSearchAttributeWriter( |
||
1193 | $this->createSearchGlossaryKeyBuilder(), |
||
1194 | )); |
||
1195 | |||
1196 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1197 | $dataImporter->addAfterImportHook($this->createProductSearchAfterImportHook()); |
||
1198 | |||
1199 | return $dataImporter; |
||
1200 | } |
||
1201 | |||
1202 | /** |
||
1203 | * @return \Pyz\Zed\DataImport\Business\Model\ProductSearchAttribute\Hook\ProductSearchAfterImportHook |
||
1204 | */ |
||
1205 | protected function createProductSearchAfterImportHook(): ProductSearchAfterImportHook |
||
1206 | { |
||
1207 | return new ProductSearchAfterImportHook(); |
||
1208 | } |
||
1209 | |||
1210 | /** |
||
1211 | * @return \Spryker\Shared\ProductSearch\Code\KeyBuilder\FilterGlossaryKeyBuilder |
||
1212 | */ |
||
1213 | protected function createSearchGlossaryKeyBuilder(): FilterGlossaryKeyBuilder |
||
1214 | { |
||
1215 | return new FilterGlossaryKeyBuilder(); |
||
1216 | } |
||
1217 | |||
1218 | /** |
||
1219 | * @return \Pyz\Zed\DataImport\Business\Model\ProductAbstract\AddCategoryKeysStep |
||
1220 | */ |
||
1221 | protected function createAddCategoryKeysStep(): AddCategoryKeysStep |
||
1222 | { |
||
1223 | return new AddCategoryKeysStep(); |
||
1224 | } |
||
1225 | |||
1226 | /** |
||
1227 | * @return \Pyz\Zed\DataImport\Business\Model\Product\AttributesExtractorStep |
||
1228 | */ |
||
1229 | protected function createAttributesExtractorStep(): AttributesExtractorStep |
||
1230 | { |
||
1231 | return new AttributesExtractorStep(); |
||
1232 | } |
||
1233 | |||
1234 | /** |
||
1235 | * @return \Pyz\Zed\DataImport\Business\Model\Product\AttributesExtractorStep |
||
1236 | */ |
||
1237 | protected function createCombinedAttributesExtractorStep(): AttributesExtractorStep |
||
1238 | { |
||
1239 | return new CombinedAttributesExtractorStep(); |
||
1240 | } |
||
1241 | |||
1242 | /** |
||
1243 | * @param array<string> $defaultAttributes |
||
1244 | * |
||
1245 | * @return \Pyz\Zed\DataImport\Business\Model\Product\ProductLocalizedAttributesExtractorStep |
||
1246 | */ |
||
1247 | protected function createProductLocalizedAttributesExtractorStep( |
||
1248 | array $defaultAttributes = [], |
||
1249 | ): ProductLocalizedAttributesExtractorStep { |
||
1250 | return new ProductLocalizedAttributesExtractorStep($defaultAttributes); |
||
1251 | } |
||
1252 | |||
1253 | /** |
||
1254 | * @param array<string> $defaultAttributes |
||
1255 | * |
||
1256 | * @return \Pyz\Zed\DataImport\Business\Model\Product\ProductLocalizedAttributesExtractorStep |
||
1257 | */ |
||
1258 | protected function createCombinedProductLocalizedAttributesExtractorStep( |
||
1259 | array $defaultAttributes = [], |
||
1260 | ): ProductLocalizedAttributesExtractorStep { |
||
1261 | return new CombinedProductLocalizedAttributesExtractorStep($defaultAttributes); |
||
1262 | } |
||
1263 | |||
1264 | /** |
||
1265 | * @return \Pyz\Zed\DataImport\Business\Model\ProductAbstract\AddProductAbstractSkusStep |
||
1266 | */ |
||
1267 | protected function createAddProductAbstractSkusStep(): AddProductAbstractSkusStep |
||
1268 | { |
||
1269 | return new AddProductAbstractSkusStep(); |
||
1270 | } |
||
1271 | |||
1272 | /** |
||
1273 | * @param string $source |
||
1274 | * @param string $target |
||
1275 | * |
||
1276 | * @return \Pyz\Zed\DataImport\Business\Model\Locale\LocaleNameToIdLocaleStep |
||
1277 | */ |
||
1278 | protected function createLocaleNameToIdStep( |
||
1279 | string $source = LocaleNameToIdLocaleStep::KEY_SOURCE, |
||
1280 | string $target = LocaleNameToIdLocaleStep::KEY_TARGET, |
||
1281 | ): LocaleNameToIdLocaleStep { |
||
1282 | return new LocaleNameToIdLocaleStep($source, $target); |
||
1283 | } |
||
1284 | |||
1285 | /** |
||
1286 | * @param string $source |
||
1287 | * @param string $target |
||
1288 | * |
||
1289 | * @return \Pyz\Zed\DataImport\Business\Model\ProductAbstract\ProductAbstractSkuToIdProductAbstractStep |
||
1290 | */ |
||
1291 | protected function createProductAbstractSkuToIdProductAbstractStep( |
||
1292 | string $source = ProductAbstractSkuToIdProductAbstractStep::KEY_SOURCE, |
||
1293 | string $target = ProductAbstractSkuToIdProductAbstractStep::KEY_TARGET, |
||
1294 | ): ProductAbstractSkuToIdProductAbstractStep { |
||
1295 | return new ProductAbstractSkuToIdProductAbstractStep($source, $target); |
||
1296 | } |
||
1297 | |||
1298 | /** |
||
1299 | * @param string $source |
||
1300 | * @param string $target |
||
1301 | * |
||
1302 | * @return \Pyz\Zed\DataImport\Business\Model\ProductConcrete\ProductSkuToIdProductStep |
||
1303 | */ |
||
1304 | protected function createProductSkuToIdProductStep( |
||
1305 | string $source = ProductSkuToIdProductStep::KEY_SOURCE, |
||
1306 | string $target = ProductSkuToIdProductStep::KEY_TARGET, |
||
1307 | ): ProductSkuToIdProductStep { |
||
1308 | return new ProductSkuToIdProductStep($source, $target); |
||
1309 | } |
||
1310 | |||
1311 | /** |
||
1312 | * @param string $source |
||
1313 | * @param string $target |
||
1314 | * |
||
1315 | * @return \Pyz\Zed\DataImport\Business\Model\Tax\TaxSetNameToIdTaxSetStep |
||
1316 | */ |
||
1317 | protected function createTaxSetNameToIdTaxSetStep( |
||
1318 | string $source = TaxSetNameToIdTaxSetStep::KEY_SOURCE, |
||
1319 | string $target = TaxSetNameToIdTaxSetStep::KEY_TARGET, |
||
1320 | ): TaxSetNameToIdTaxSetStep { |
||
1321 | return new TaxSetNameToIdTaxSetStep($source, $target); |
||
1322 | } |
||
1323 | |||
1324 | /** |
||
1325 | * @return \Pyz\Zed\DataImport\Business\Model\ProductAttributeKey\AddProductAttributeKeysStep |
||
1326 | */ |
||
1327 | protected function createAddProductAttributeKeysStep(): AddProductAttributeKeysStep |
||
1328 | { |
||
1329 | return new AddProductAttributeKeysStep(); |
||
1330 | } |
||
1331 | |||
1332 | /** |
||
1333 | * @return \Spryker\Zed\Event\Business\EventFacadeInterface |
||
1334 | */ |
||
1335 | protected function getEventFacade(): EventFacadeInterface |
||
1336 | { |
||
1337 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_EVENT); |
||
1338 | } |
||
1339 | |||
1340 | /** |
||
1341 | * @return \Spryker\Zed\Currency\Business\CurrencyFacadeInterface |
||
1342 | */ |
||
1343 | protected function getCurrencyFacade(): CurrencyFacadeInterface |
||
1344 | { |
||
1345 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_CURRENCY); |
||
1346 | } |
||
1347 | |||
1348 | /** |
||
1349 | * @return \Spryker\Zed\PriceProduct\Business\PriceProductFacadeInterface |
||
1350 | */ |
||
1351 | public function getPriceProductFacade(): PriceProductFacadeInterface |
||
1352 | { |
||
1353 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_PRICE_PRODUCT); |
||
1354 | } |
||
1355 | |||
1356 | /** |
||
1357 | * @return \Spryker\Zed\Stock\Business\StockFacadeInterface |
||
1358 | */ |
||
1359 | protected function getStockFacade(): StockFacadeInterface |
||
1360 | { |
||
1361 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_STOCK); |
||
1362 | } |
||
1363 | |||
1364 | /** |
||
1365 | * @return \Spryker\Zed\Store\Business\StoreFacadeInterface |
||
1366 | */ |
||
1367 | protected function getStoreFacade(): StoreFacadeInterface |
||
1368 | { |
||
1369 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_STORE); |
||
1370 | } |
||
1371 | |||
1372 | /** |
||
1373 | * @return \Spryker\Zed\DataImport\Business\Model\DataImportStep\DataImportStepInterface |
||
1374 | */ |
||
1375 | protected function createAddLocalesStep(): DataImportStepInterface |
||
1376 | { |
||
1377 | return new AddLocalesStep($this->getDataImportStoreFacade()); |
||
1378 | } |
||
1379 | |||
1380 | /** |
||
1381 | * @return \Pyz\Zed\DataImport\Business\Model\ProductImage\Repository\ProductImageRepositoryInterface |
||
1382 | */ |
||
1383 | public function createProductImageRepository(): ProductImageRepositoryInterface |
||
1384 | { |
||
1385 | return new ProductImageRepository(); |
||
1386 | } |
||
1387 | |||
1388 | /** |
||
1389 | * @param string $importType |
||
1390 | * @param \Spryker\Zed\DataImport\Business\Model\DataReader\DataReaderInterface $reader |
||
1391 | * |
||
1392 | * @return \Pyz\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareConditional |
||
1393 | */ |
||
1394 | public function createDataImporterWriterAwareConditional( |
||
1395 | string $importType, |
||
1396 | DataReaderInterface $reader, |
||
1397 | ): DataImporterDataSetWriterAwareConditional { |
||
1398 | return new DataImporterDataSetWriterAwareConditional($importType, $reader, $this->getGracefulRunnerFacade()); |
||
1399 | } |
||
1400 | |||
1401 | /** |
||
1402 | * @param \Generated\Shared\Transfer\DataImporterConfigurationTransfer $dataImporterConfigurationTransfer |
||
1403 | * |
||
1404 | * @return \Pyz\Zed\DataImport\Business\Model\DataImporterConditional |
||
1405 | */ |
||
1406 | public function getConditionalCsvDataImporterFromConfig( |
||
1407 | DataImporterConfigurationTransfer $dataImporterConfigurationTransfer, |
||
1408 | ): DataImporterConditional { |
||
1409 | $csvReader = $this->createCsvReaderFromConfig($dataImporterConfigurationTransfer->getReaderConfiguration()); |
||
1410 | |||
1411 | return $this->createDataImporterConditional($dataImporterConfigurationTransfer->getImportType(), $csvReader); |
||
1412 | } |
||
1413 | |||
1414 | /** |
||
1415 | * @param \Generated\Shared\Transfer\DataImporterConfigurationTransfer $dataImporterConfigurationTransfer |
||
1416 | * |
||
1417 | * @return \Pyz\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareConditional |
||
1418 | */ |
||
1419 | public function getConditionalCsvDataImporterWriterAwareFromConfig( |
||
1420 | DataImporterConfigurationTransfer $dataImporterConfigurationTransfer, |
||
1421 | ): DataImporterDataSetWriterAwareConditional { |
||
1422 | $csvReader = $this->createCsvReaderFromConfig($dataImporterConfigurationTransfer->getReaderConfiguration()); |
||
1423 | |||
1424 | return $this->createDataImporterWriterAwareConditional($dataImporterConfigurationTransfer->getImportType(), $csvReader); |
||
1425 | } |
||
1426 | |||
1427 | /** |
||
1428 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
1429 | */ |
||
1430 | public function createCombinedProductPricePropelDataSetWriter(): DataSetWriterInterface |
||
1431 | { |
||
1432 | return new CombinedProductPricePropelDataSetWriter( |
||
1433 | $this->createProductRepository(), |
||
1434 | $this->getStoreFacade(), |
||
1435 | $this->getCurrencyFacade(), |
||
1436 | ); |
||
1437 | } |
||
1438 | |||
1439 | /** |
||
1440 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
1441 | */ |
||
1442 | public function createCombinedProductImagePropelDataSetWriter(): DataSetWriterInterface |
||
1443 | { |
||
1444 | return new CombinedProductImagePropelDataSetWriter( |
||
1445 | $this->createProductImageRepository(), |
||
1446 | ); |
||
1447 | } |
||
1448 | |||
1449 | /** |
||
1450 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
1451 | */ |
||
1452 | public function createCombinedProductStockPropelDataSetWriter(): DataSetWriterInterface |
||
1453 | { |
||
1454 | return new CombinedProductStockPropelDataSetWriter( |
||
1455 | $this->getProductBundleFacade(), |
||
1456 | $this->createProductRepository(), |
||
1457 | $this->getStoreFacade(), |
||
1458 | $this->getStockFacade(), |
||
1459 | ); |
||
1460 | } |
||
1461 | |||
1462 | /** |
||
1463 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
1464 | */ |
||
1465 | public function createCombinedProductAbstractStorePropelDataSetWriter(): DataSetWriterInterface |
||
1466 | { |
||
1467 | return new CombinedProductAbstractStorePropelDataSetWriter(); |
||
1468 | } |
||
1469 | |||
1470 | /** |
||
1471 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
1472 | */ |
||
1473 | public function createCombinedProductAbstractPropelDataSetWriter(): DataSetWriterInterface |
||
1474 | { |
||
1475 | return new CombinedProductAbstractPropelDataSetWriter( |
||
1476 | $this->createProductRepository(), |
||
1477 | ); |
||
1478 | } |
||
1479 | |||
1480 | /** |
||
1481 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
1482 | */ |
||
1483 | public function createCombinedProductConcretePropelDataSetWriter(): DataSetWriterInterface |
||
1484 | { |
||
1485 | return new CombinedProductConcretePropelDataSetWriter( |
||
1486 | $this->createProductRepository(), |
||
1487 | ); |
||
1488 | } |
||
1489 | |||
1490 | /** |
||
1491 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1492 | * |
||
1493 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1494 | */ |
||
1495 | public function createCombinedProductPriceImporter( |
||
1496 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1497 | ): DataImporterInterface { |
||
1498 | $dataImporter = $this->getConditionalCsvDataImporterWriterAwareFromConfig( |
||
1499 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1500 | ); |
||
1501 | |||
1502 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CombinedProductPriceHydratorStep::BULK_SIZE); |
||
1503 | $dataSetStepBroker |
||
1504 | ->addStep(new CombinedProductPriceHydratorStep( |
||
1505 | $this->getPriceProductFacade(), |
||
1506 | $this->getUtilEncodingService(), |
||
1507 | )); |
||
1508 | |||
1509 | $dataImporter->setDataSetCondition($this->createCombinedProductPriceMandatoryColumnCondition()); |
||
1510 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1511 | $dataImporter->setDataSetWriter($this->createCombinedProductPriceDataSetWriters()); |
||
1512 | |||
1513 | return $dataImporter; |
||
1514 | } |
||
1515 | |||
1516 | /** |
||
1517 | * @return \Pyz\Zed\DataImport\Business\Model\DataSet\DataSetConditionInterface |
||
1518 | */ |
||
1519 | protected function createCombinedProductPriceMandatoryColumnCondition(): DataSetConditionInterface |
||
1520 | { |
||
1521 | return new CombinedProductPriceMandatoryColumnCondition(); |
||
1522 | } |
||
1523 | |||
1524 | /** |
||
1525 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
1526 | */ |
||
1527 | protected function createCombinedProductPriceDataSetWriters(): DataSetWriterInterface |
||
1528 | { |
||
1529 | return new DataSetWriterCollection($this->createCombinedProductPriceDataSetWriterPlugins()); |
||
1530 | } |
||
1531 | |||
1532 | /** |
||
1533 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
1534 | */ |
||
1535 | protected function createCombinedProductPriceDataSetWriterPlugins(): array |
||
1536 | { |
||
1537 | return [ |
||
1538 | new CombinedProductPricePropelWriterPlugin(), |
||
1539 | ]; |
||
1540 | } |
||
1541 | |||
1542 | /** |
||
1543 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1544 | * |
||
1545 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1546 | */ |
||
1547 | public function createCombinedProductImageImporter( |
||
1566 | } |
||
1567 | |||
1568 | /** |
||
1569 | * @return \Pyz\Zed\DataImport\Business\Model\DataSet\DataSetConditionInterface |
||
1570 | */ |
||
1571 | protected function createCombinedProductImageMandatoryColumnCondition(): DataSetConditionInterface |
||
1572 | { |
||
1573 | return new CombinedProductImageMandatoryColumnCondition(); |
||
1574 | } |
||
1575 | |||
1576 | /** |
||
1577 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
1578 | */ |
||
1579 | protected function createCombinedProductImageDataSetWriters(): DataSetWriterInterface |
||
1580 | { |
||
1581 | return new DataSetWriterCollection($this->createCombinedProductImageDataSetWriterPlugins()); |
||
1582 | } |
||
1583 | |||
1584 | /** |
||
1585 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
1586 | */ |
||
1587 | protected function createCombinedProductImageDataSetWriterPlugins(): array |
||
1588 | { |
||
1589 | return [ |
||
1590 | new CombinedProductImagePropelWriterPlugin(), |
||
1591 | ]; |
||
1592 | } |
||
1593 | |||
1594 | /** |
||
1595 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1596 | * |
||
1597 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1598 | */ |
||
1599 | public function createCombinedProductStockImporter( |
||
1600 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1601 | ): DataImporterInterface { |
||
1602 | $dataImporter = $this->getConditionalCsvDataImporterWriterAwareFromConfig( |
||
1603 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1604 | ); |
||
1605 | |||
1606 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CombinedProductStockHydratorStep::BULK_SIZE); |
||
1607 | $dataSetStepBroker |
||
1608 | ->addStep(new CombinedProductStockHydratorStep()); |
||
1609 | |||
1610 | $dataImporter->setDataSetCondition($this->createCombinedProductStockMandatoryColumnCondition()); |
||
1611 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1612 | $dataImporter->setDataSetWriter($this->createCombinedProductStockDataSetWriters()); |
||
1613 | |||
1614 | return $dataImporter; |
||
1615 | } |
||
1616 | |||
1617 | /** |
||
1618 | * @return \Pyz\Zed\DataImport\Business\Model\DataSet\DataSetConditionInterface |
||
1619 | */ |
||
1620 | protected function createCombinedProductStockMandatoryColumnCondition(): DataSetConditionInterface |
||
1621 | { |
||
1622 | return new CombinedProductStockMandatoryColumnCondition(); |
||
1623 | } |
||
1624 | |||
1625 | /** |
||
1626 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
1627 | */ |
||
1628 | protected function createCombinedProductStockDataSetWriters(): DataSetWriterInterface |
||
1629 | { |
||
1630 | return new DataSetWriterCollection($this->createCombinedProductStockDataSetWriterPlugins()); |
||
1631 | } |
||
1632 | |||
1633 | /** |
||
1634 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
1635 | */ |
||
1636 | protected function createCombinedProductStockDataSetWriterPlugins(): array |
||
1637 | { |
||
1638 | return [ |
||
1639 | new CombinedProductStockPropelWriterPlugin(), |
||
1640 | ]; |
||
1641 | } |
||
1642 | |||
1643 | /** |
||
1644 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1645 | * |
||
1646 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1647 | */ |
||
1648 | public function createCombinedProductAbstractStoreImporter( |
||
1649 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1650 | ): DataImporterInterface { |
||
1651 | $dataImporter = $this->getConditionalCsvDataImporterWriterAwareFromConfig( |
||
1652 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1653 | ); |
||
1654 | |||
1655 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CombinedProductAbstractStoreHydratorStep::BULK_SIZE); |
||
1656 | $dataSetStepBroker->addStep(new CombinedProductAbstractStoreHydratorStep()); |
||
1657 | |||
1658 | $dataImporter->setDataSetCondition($this->createCombinedProductAbstractStoreMandatoryColumnCondition()); |
||
1659 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1660 | $dataImporter->setDataSetWriter($this->createCombinedProductAbstractStoreDataSetWriters()); |
||
1661 | |||
1662 | return $dataImporter; |
||
1663 | } |
||
1664 | |||
1665 | /** |
||
1666 | * @return \Pyz\Zed\DataImport\Business\Model\DataSet\DataSetConditionInterface |
||
1667 | */ |
||
1668 | protected function createCombinedProductAbstractStoreMandatoryColumnCondition(): DataSetConditionInterface |
||
1669 | { |
||
1670 | return new CombinedProductAbstractStoreMandatoryColumnCondition(); |
||
1671 | } |
||
1672 | |||
1673 | /** |
||
1674 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
1675 | */ |
||
1676 | protected function createCombinedProductAbstractStoreDataSetWriters(): DataSetWriterInterface |
||
1677 | { |
||
1678 | return new DataSetWriterCollection($this->createCombinedProductAbstractStoreDataSetWriterPlugins()); |
||
1679 | } |
||
1680 | |||
1681 | /** |
||
1682 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
1683 | */ |
||
1684 | protected function createCombinedProductAbstractStoreDataSetWriterPlugins(): array |
||
1685 | { |
||
1686 | return [ |
||
1687 | new CombinedProductAbstractStorePropelWriterPlugin(), |
||
1688 | ]; |
||
1689 | } |
||
1690 | |||
1691 | /** |
||
1692 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1693 | * |
||
1694 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1695 | */ |
||
1696 | public function createCombinedProductAbstractImporter( |
||
1697 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1698 | ): DataImporterInterface { |
||
1699 | $dataImporter = $this->getConditionalCsvDataImporterWriterAwareFromConfig( |
||
1700 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1701 | ); |
||
1702 | |||
1703 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CombinedProductAbstractHydratorStep::BULK_SIZE); |
||
1704 | $dataSetStepBroker |
||
1705 | ->addStep($this->createProductAbstractCheckExistenceStep()) |
||
1706 | ->addStep($this->createAddLocalesStep()) |
||
1707 | ->addStep($this->createAddCategoryKeysStep()) |
||
1708 | ->addStep($this->createTaxSetNameToIdTaxSetStep(CombinedProductAbstractHydratorStep::COLUMN_TAX_SET_NAME)) |
||
1709 | ->addStep($this->createCombinedAttributesExtractorStep()) |
||
1710 | ->addStep($this->createCombinedProductLocalizedAttributesExtractorStep([ |
||
1711 | CombinedProductAbstractHydratorStep::COLUMN_NAME, |
||
1712 | CombinedProductAbstractHydratorStep::COLUMN_URL, |
||
1713 | CombinedProductAbstractHydratorStep::COLUMN_DESCRIPTION, |
||
1714 | CombinedProductAbstractHydratorStep::COLUMN_META_TITLE, |
||
1715 | CombinedProductAbstractHydratorStep::COLUMN_META_DESCRIPTION, |
||
1716 | CombinedProductAbstractHydratorStep::COLUMN_META_KEYWORDS, |
||
1717 | ])) |
||
1718 | ->addStep(new CombinedProductAbstractHydratorStep()); |
||
1719 | |||
1720 | $dataImporter->setDataSetCondition($this->createCombinedProductAbstractTypeDataSetCondition()); |
||
1721 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1722 | $dataImporter->setDataSetWriter($this->createCombinedProductAbstractDataSetWriters()); |
||
1723 | |||
1724 | return $dataImporter; |
||
1725 | } |
||
1726 | |||
1727 | /** |
||
1728 | * @return \Pyz\Zed\DataImport\Business\Model\DataSet\DataSetConditionInterface |
||
1729 | */ |
||
1730 | protected function createCombinedProductAbstractTypeDataSetCondition(): DataSetConditionInterface |
||
1731 | { |
||
1732 | return new CombinedProductAbstractTypeDataSetCondition(); |
||
1733 | } |
||
1734 | |||
1735 | /** |
||
1736 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
1737 | */ |
||
1738 | protected function createCombinedProductAbstractDataSetWriters(): DataSetWriterInterface |
||
1739 | { |
||
1740 | return new DataSetWriterCollection($this->createCombinedProductAbstractDataSetWriterPlugins()); |
||
1741 | } |
||
1742 | |||
1743 | /** |
||
1744 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
1745 | */ |
||
1746 | protected function createCombinedProductAbstractDataSetWriterPlugins(): array |
||
1747 | { |
||
1748 | return [ |
||
1749 | new CombinedProductAbstractPropelWriterPlugin(), |
||
1750 | ]; |
||
1751 | } |
||
1752 | |||
1753 | /** |
||
1754 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1755 | * |
||
1756 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1757 | */ |
||
1758 | public function createCombinedProductConcreteImporter( |
||
1759 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
1760 | ): DataImporterInterface { |
||
1761 | $dataImporter = $this->getConditionalCsvDataImporterWriterAwareFromConfig( |
||
1762 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
1763 | ); |
||
1764 | |||
1765 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CombinedProductConcreteHydratorStep::BULK_SIZE); |
||
1766 | $dataSetStepBroker |
||
1767 | ->addStep($this->createProductConcreteCheckExistenceStep()) |
||
1768 | ->addStep($this->createAddLocalesStep()) |
||
1769 | ->addStep($this->createCombinedAttributesExtractorStep()) |
||
1770 | ->addStep($this->createProductConcreteAttributesUniqueCheckStep()) |
||
1771 | ->addStep($this->createCombinedProductLocalizedAttributesExtractorStep([ |
||
1772 | CombinedProductConcreteHydratorStep::COLUMN_NAME, |
||
1773 | CombinedProductConcreteHydratorStep::COLUMN_DESCRIPTION, |
||
1774 | CombinedProductConcreteHydratorStep::COLUMN_IS_SEARCHABLE, |
||
1775 | ])) |
||
1776 | ->addStep(new CombinedProductConcreteHydratorStep( |
||
1777 | $this->createProductRepository(), |
||
1778 | )); |
||
1779 | |||
1780 | $dataImporter->setDataSetCondition($this->createCombinedProductConcreteTypeDataSetCondition()); |
||
1781 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
1782 | $dataImporter->setDataSetWriter($this->createCombinedProductConcreteDataSetWriters()); |
||
1783 | |||
1784 | return $dataImporter; |
||
1785 | } |
||
1786 | |||
1787 | /** |
||
1788 | * @return \Pyz\Zed\DataImport\Business\Model\DataSet\DataSetConditionInterface |
||
1789 | */ |
||
1790 | protected function createCombinedProductConcreteTypeDataSetCondition(): DataSetConditionInterface |
||
1791 | { |
||
1792 | return new CombinedProductConcreteTypeDataSetCondition(); |
||
1793 | } |
||
1794 | |||
1795 | /** |
||
1796 | * @return \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetWriterInterface |
||
1797 | */ |
||
1798 | protected function createCombinedProductConcreteDataSetWriters(): DataSetWriterInterface |
||
1799 | { |
||
1800 | return new DataSetWriterCollection($this->createCombinedProductConcreteDataSetWriterPlugins()); |
||
1801 | } |
||
1802 | |||
1803 | /** |
||
1804 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
1805 | */ |
||
1806 | protected function createCombinedProductConcreteDataSetWriterPlugins(): array |
||
1807 | { |
||
1808 | return [ |
||
1809 | new CombinedProductConcretePropelWriterPlugin(), |
||
1810 | ]; |
||
1811 | } |
||
1812 | |||
1813 | /** |
||
1814 | * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer |
||
1815 | * |
||
1816 | * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface |
||
1817 | */ |
||
1818 | public function createCombinedProductGroupImporter( |
||
1833 | } |
||
1834 | |||
1835 | /** |
||
1836 | * @return \Pyz\Zed\DataImport\Business\Model\DataSet\DataSetConditionInterface |
||
1837 | */ |
||
1838 | protected function createCombinedProductGroupMandatoryColumnCondition(): DataSetConditionInterface |
||
1839 | { |
||
1840 | return new CombinedProductGroupMandatoryColumnCondition(); |
||
1841 | } |
||
1842 | } |
||
1843 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths