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