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