| Total Complexity | 148 |
| Total Lines | 1279 |
| 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 | public function getDataImporterByType(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): ?DataImporterInterface |
||
| 136 | { |
||
| 137 | switch ($dataImportConfigurationActionTransfer->getDataEntity()) { |
||
| 138 | case DataImportConfig::IMPORT_TYPE_CURRENCY: |
||
| 139 | return $this->createCurrencyImporter($dataImportConfigurationActionTransfer); |
||
| 140 | case DataImportConfig::IMPORT_TYPE_CATEGORY_TEMPLATE: |
||
| 141 | return $this->createCategoryTemplateImporter($dataImportConfigurationActionTransfer); |
||
| 142 | case DataImportConfig::IMPORT_TYPE_CUSTOMER: |
||
| 143 | return $this->createCustomerImporter($dataImportConfigurationActionTransfer); |
||
| 144 | case DataImportConfig::IMPORT_TYPE_GLOSSARY: |
||
| 145 | return $this->createGlossaryImporter($dataImportConfigurationActionTransfer); |
||
| 146 | case DataImportConfig::IMPORT_TYPE_TAX: |
||
| 147 | return $this->createTaxImporter($dataImportConfigurationActionTransfer); |
||
| 148 | case DataImportConfig::IMPORT_TYPE_DISCOUNT: |
||
| 149 | return $this->createDiscountImporter($dataImportConfigurationActionTransfer); |
||
| 150 | case DataImportConfig::IMPORT_TYPE_DISCOUNT_STORE: |
||
| 151 | return $this->createDiscountStoreImporter($dataImportConfigurationActionTransfer); |
||
| 152 | case DataImportConfig::IMPORT_TYPE_DISCOUNT_VOUCHER: |
||
| 153 | return $this->createDiscountVoucherImporter($dataImportConfigurationActionTransfer); |
||
| 154 | case DataImportConfig::IMPORT_TYPE_PRODUCT_ATTRIBUTE_KEY: |
||
| 155 | return $this->createProductAttributeKeyImporter($dataImportConfigurationActionTransfer); |
||
| 156 | case DataImportConfig::IMPORT_TYPE_PRODUCT_MANAGEMENT_ATTRIBUTE: |
||
| 157 | return $this->createProductManagementAttributeImporter($dataImportConfigurationActionTransfer); |
||
| 158 | case DataImportConfig::IMPORT_TYPE_PRODUCT_ABSTRACT: |
||
| 159 | return $this->createProductAbstractImporter($dataImportConfigurationActionTransfer); |
||
| 160 | case DataImportConfig::IMPORT_TYPE_PRODUCT_ABSTRACT_STORE: |
||
| 161 | return $this->createProductAbstractStoreImporter($dataImportConfigurationActionTransfer); |
||
| 162 | case DataImportConfig::IMPORT_TYPE_PRODUCT_CONCRETE: |
||
| 163 | return $this->createProductConcreteImporter($dataImportConfigurationActionTransfer); |
||
| 164 | case DataImportConfig::IMPORT_TYPE_PRODUCT_IMAGE: |
||
| 165 | return $this->createProductImageImporter($dataImportConfigurationActionTransfer); |
||
| 166 | case DataImportConfig::IMPORT_TYPE_PRODUCT_OPTION: |
||
| 167 | return $this->createProductOptionImporter($dataImportConfigurationActionTransfer); |
||
| 168 | case DataImportConfig::IMPORT_TYPE_PRODUCT_OPTION_PRICE: |
||
| 169 | return $this->createProductOptionPriceImporter($dataImportConfigurationActionTransfer); |
||
| 170 | case DataImportConfig::IMPORT_TYPE_PRODUCT_GROUP: |
||
| 171 | return $this->createProductGroupImporter($dataImportConfigurationActionTransfer); |
||
| 172 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_ABSTRACT: |
||
| 173 | return $this->createCombinedProductAbstractImporter($dataImportConfigurationActionTransfer); |
||
| 174 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_ABSTRACT_STORE: |
||
| 175 | return $this->createCombinedProductAbstractStoreImporter($dataImportConfigurationActionTransfer); |
||
| 176 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_CONCRETE: |
||
| 177 | return $this->createCombinedProductConcreteImporter($dataImportConfigurationActionTransfer); |
||
| 178 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_IMAGE: |
||
| 179 | return $this->createCombinedProductImageImporter($dataImportConfigurationActionTransfer); |
||
| 180 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_PRICE: |
||
| 181 | return $this->createCombinedProductPriceImporter($dataImportConfigurationActionTransfer); |
||
| 182 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_STOCK: |
||
| 183 | return $this->createCombinedProductStockImporter($dataImportConfigurationActionTransfer); |
||
| 184 | case DataImportConfig::IMPORT_TYPE_COMBINED_PRODUCT_GROUP: |
||
| 185 | return $this->createCombinedProductGroupImporter($dataImportConfigurationActionTransfer); |
||
| 186 | case DataImportConfig::IMPORT_TYPE_PRODUCT_REVIEW: |
||
| 187 | return $this->createProductReviewImporter($dataImportConfigurationActionTransfer); |
||
| 188 | case DataImportConfig::IMPORT_TYPE_PRODUCT_SET: |
||
| 189 | return $this->createProductSetImporter($dataImportConfigurationActionTransfer); |
||
| 190 | case DataImportConfig::IMPORT_TYPE_PRODUCT_SEARCH_ATTRIBUTE_MAP: |
||
| 191 | return $this->createProductSearchAttributeMapImporter($dataImportConfigurationActionTransfer); |
||
| 192 | case DataImportConfig::IMPORT_TYPE_PRODUCT_SEARCH_ATTRIBUTE: |
||
| 193 | return $this->createProductSearchAttributeImporter($dataImportConfigurationActionTransfer); |
||
| 194 | case DataImportConfig::IMPORT_TYPE_CMS_TEMPLATE: |
||
| 195 | return $this->createCmsTemplateImporter($dataImportConfigurationActionTransfer); |
||
| 196 | case DataImportConfig::IMPORT_TYPE_CMS_BLOCK: |
||
| 197 | return $this->createCmsBlockImporter($dataImportConfigurationActionTransfer); |
||
| 198 | case DataImportConfig::IMPORT_TYPE_CMS_BLOCK_STORE: |
||
| 199 | return $this->createCmsBlockStoreImporter($dataImportConfigurationActionTransfer); |
||
| 200 | case DataImportConfig::IMPORT_TYPE_DISCOUNT_AMOUNT: |
||
| 201 | return $this->createDiscountAmountImporter($dataImportConfigurationActionTransfer); |
||
| 202 | case DataImportConfig::IMPORT_TYPE_PRODUCT_STOCK: |
||
| 203 | return $this->createProductStockImporter($dataImportConfigurationActionTransfer); |
||
| 204 | case DataImportConfig::IMPORT_TYPE_NAVIGATION: |
||
| 205 | return $this->createNavigationImporter($dataImportConfigurationActionTransfer); |
||
| 206 | case DataImportConfig::IMPORT_TYPE_NAVIGATION_NODE: |
||
| 207 | return $this->createNavigationNodeImporter($dataImportConfigurationActionTransfer); |
||
| 208 | default: |
||
| 209 | return null; |
||
| 210 | } |
||
| 211 | } |
||
| 212 | |||
| 213 | public function createCurrencyImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
| 214 | { |
||
| 215 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 216 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 217 | ); |
||
| 218 | |||
| 219 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
| 220 | $dataSetStepBroker->addStep(new CurrencyWriterStep()); |
||
| 221 | |||
| 222 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 223 | |||
| 224 | return $dataImporter; |
||
| 225 | } |
||
| 226 | |||
| 227 | public function createGlossaryImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
| 228 | { |
||
| 229 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 230 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 231 | ); |
||
| 232 | |||
| 233 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(GlossaryWriterStep::BULK_SIZE); |
||
| 234 | $dataSetStepBroker |
||
| 235 | ->addStep($this->createLocaleNameToIdStep(GlossaryWriterStep::KEY_LOCALE)) |
||
| 236 | ->addStep(new GlossaryWriterStep()); |
||
| 237 | |||
| 238 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 239 | |||
| 240 | return $dataImporter; |
||
| 241 | } |
||
| 242 | |||
| 243 | public function createCategoryTemplateImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
| 244 | { |
||
| 245 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 246 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 247 | ); |
||
| 248 | |||
| 249 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
| 250 | $dataSetStepBroker |
||
| 251 | ->addStep(new CategoryTemplateWriterStep()); |
||
| 252 | |||
| 253 | $dataImporter |
||
| 254 | ->addDataSetStepBroker($dataSetStepBroker); |
||
| 255 | |||
| 256 | return $dataImporter; |
||
| 257 | } |
||
| 258 | |||
| 259 | public function createCustomerImporter( |
||
| 260 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 261 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 262 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 263 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 264 | ); |
||
| 265 | |||
| 266 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
| 267 | $dataSetStepBroker->addStep(new CustomerWriterStep()); |
||
| 268 | |||
| 269 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 270 | |||
| 271 | return $dataImporter; |
||
| 272 | } |
||
| 273 | |||
| 274 | public function createCmsTemplateImporter( |
||
| 275 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 276 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 277 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 278 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 279 | ); |
||
| 280 | |||
| 281 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
| 282 | $dataSetStepBroker |
||
| 283 | ->addStep(new CmsTemplateWriterStep()); |
||
| 284 | |||
| 285 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 286 | |||
| 287 | return $dataImporter; |
||
| 288 | } |
||
| 289 | |||
| 290 | public function createCmsBlockImporter( |
||
| 291 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 292 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 293 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 294 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 295 | ); |
||
| 296 | |||
| 297 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CmsBlockWriterStep::BULK_SIZE); |
||
| 298 | $dataSetStepBroker |
||
| 299 | ->addStep($this->createAddLocalesStep()) |
||
| 300 | ->addStep($this->createLocalizedAttributesExtractorStep([ |
||
| 301 | CmsBlockWriterStep::KEY_PLACEHOLDER_TITLE, |
||
| 302 | CmsBlockWriterStep::KEY_PLACEHOLDER_CONTENT, |
||
| 303 | CmsBlockWriterStep::KEY_PLACEHOLDER_LINK, |
||
| 304 | CmsBlockWriterStep::KEY_PLACEHOLDER_IMAGE_URL, |
||
| 305 | ])) |
||
| 306 | ->addStep(new CmsBlockWriterStep()); |
||
| 307 | |||
| 308 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 309 | |||
| 310 | return $dataImporter; |
||
| 311 | } |
||
| 312 | |||
| 313 | public function createCmsBlockStoreImporter( |
||
| 314 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 315 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 316 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 317 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 318 | ); |
||
| 319 | |||
| 320 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CmsBlockStoreWriterStep::BULK_SIZE); |
||
| 321 | $dataSetStepBroker->addStep(new CmsBlockStoreWriterStep()); |
||
| 322 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 323 | |||
| 324 | return $dataImporter; |
||
| 325 | } |
||
| 326 | |||
| 327 | public function createDiscountImporter( |
||
| 328 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 329 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 330 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 331 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 332 | ); |
||
| 333 | |||
| 334 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(DiscountWriterStep::BULK_SIZE); |
||
| 335 | $dataSetStepBroker |
||
| 336 | ->addStep(new DiscountWriterStep()); |
||
| 337 | |||
| 338 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 339 | |||
| 340 | return $dataImporter; |
||
| 341 | } |
||
| 342 | |||
| 343 | public function createDiscountStoreImporter( |
||
| 344 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 345 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 346 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 347 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 348 | ); |
||
| 349 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(DiscountStoreWriterStep::BULK_SIZE); |
||
| 350 | $dataSetStepBroker |
||
| 351 | ->addStep(new DiscountStoreWriterStep()); |
||
| 352 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 353 | |||
| 354 | return $dataImporter; |
||
| 355 | } |
||
| 356 | |||
| 357 | public function createDiscountAmountImporter( |
||
| 358 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 359 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 360 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 361 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 362 | ); |
||
| 363 | |||
| 364 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(DiscountAmountWriterStep::BULK_SIZE); |
||
| 365 | $dataSetStepBroker |
||
| 366 | ->addStep(new DiscountAmountWriterStep()); |
||
| 367 | |||
| 368 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 369 | |||
| 370 | return $dataImporter; |
||
| 371 | } |
||
| 372 | |||
| 373 | public function createDiscountVoucherImporter( |
||
| 374 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 375 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 376 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 377 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 378 | ); |
||
| 379 | |||
| 380 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(DiscountVoucherWriterStep::BULK_SIZE); |
||
| 381 | $dataSetStepBroker |
||
| 382 | ->addStep(new DiscountVoucherWriterStep($this->createDiscountConfig())); |
||
| 383 | |||
| 384 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 385 | |||
| 386 | return $dataImporter; |
||
| 387 | } |
||
| 388 | |||
| 389 | public function createDiscountConfig(): DiscountConfig |
||
| 390 | { |
||
| 391 | return new DiscountConfig(); |
||
| 392 | } |
||
| 393 | |||
| 394 | public function createProductOptionImporter( |
||
| 395 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 396 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 397 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 398 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 399 | ); |
||
| 400 | |||
| 401 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
| 402 | $dataSetStepBroker |
||
| 403 | ->addStep($this->createAddLocalesStep()) |
||
| 404 | ->addStep($this->createTaxSetNameToIdTaxSetStep(ProductOptionWriterStep::KEY_TAX_SET_NAME)) |
||
| 405 | ->addStep($this->createLocalizedAttributesExtractorStep([ |
||
| 406 | ProductOptionWriterStep::KEY_GROUP_NAME, |
||
| 407 | ProductOptionWriterStep::KEY_OPTION_NAME, |
||
| 408 | ])) |
||
| 409 | ->addStep(new ProductOptionWriterStep()); |
||
| 410 | |||
| 411 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 412 | |||
| 413 | return $dataImporter; |
||
| 414 | } |
||
| 415 | |||
| 416 | public function createProductOptionPriceImporter( |
||
| 417 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 418 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 419 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 420 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 421 | ); |
||
| 422 | |||
| 423 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
| 424 | $dataSetStepBroker |
||
| 425 | ->addStep(new ProductOptionPriceWriterStep()); |
||
| 426 | |||
| 427 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 428 | |||
| 429 | return $dataImporter; |
||
| 430 | } |
||
| 431 | |||
| 432 | public function createProductStockImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
| 433 | { |
||
| 434 | /** @var \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface|\Spryker\Zed\DataImport\Business\Model\DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareInterface $dataImporter */ |
||
| 435 | $dataImporter = $this->getCsvDataImporterWriterAwareFromConfig( |
||
| 436 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 437 | ); |
||
| 438 | |||
| 439 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductStockHydratorStep::BULK_SIZE); |
||
| 440 | $dataSetStepBroker |
||
| 441 | ->addStep(new ProductStockHydratorStep()); |
||
| 442 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 443 | $dataImporter->setDataSetWriter($this->createProductStockDataImportWriters()); |
||
| 444 | |||
| 445 | return $dataImporter; |
||
| 446 | } |
||
| 447 | |||
| 448 | public function getProductBundleFacade(): ProductBundleFacadeInterface |
||
| 449 | { |
||
| 450 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_PRODUCT_BUNDLE); |
||
| 451 | } |
||
| 452 | |||
| 453 | public function createProductImageImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
| 454 | { |
||
| 455 | /** @var \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface|\Spryker\Zed\DataImport\Business\Model\DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareInterface $dataImporter */ |
||
| 456 | $dataImporter = $this->getCsvDataImporterWriterAwareFromConfig( |
||
| 457 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 458 | ); |
||
| 459 | |||
| 460 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductImageHydratorStep::BULK_SIZE); |
||
| 461 | $dataSetStepBroker |
||
| 462 | ->addStep($this->createProductAbstractSkuToIdProductAbstractStep(ProductImageHydratorStep::COLUMN_ABSTRACT_SKU, ProductImageHydratorStep::KEY_IMAGE_SET_FK_PRODUCT_ABSTRACT)) |
||
| 463 | ->addStep($this->createProductSkuToIdProductStep(ProductImageHydratorStep::COLUMN_CONCRETE_SKU, ProductImageHydratorStep::KEY_IMAGE_SET_FK_PRODUCT)) |
||
| 464 | ->addStep($this->createLocaleNameToIdStep(ProductImageHydratorStep::COLUMN_LOCALE, ProductImageHydratorStep::KEY_IMAGE_SET_FK_LOCALE)) |
||
| 465 | ->addStep(new ProductImageHydratorStep()) |
||
| 466 | ->addStep($this->createAddLocalesStep()) |
||
| 467 | ->addStep($this->createLocalizedAttributesExtractorStep([ |
||
| 468 | ProductImagePropelDataSetWriter::KEY_ALT_TEXT_SMALL, |
||
| 469 | ProductImagePropelDataSetWriter::KEY_ALT_TEXT_LARGE, |
||
| 470 | ])); |
||
| 471 | |||
| 472 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 473 | $dataImporter->setDataSetWriter($this->createProductImageDataWriters()); |
||
| 474 | |||
| 475 | return $dataImporter; |
||
| 476 | } |
||
| 477 | |||
| 478 | public function createLocaleRepository(): LocaleRepositoryInterface |
||
| 479 | { |
||
| 480 | return new LocaleRepository(); |
||
| 481 | } |
||
| 482 | |||
| 483 | public function createTaxImporter( |
||
| 484 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 485 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 486 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 487 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 488 | ); |
||
| 489 | |||
| 490 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(TaxWriterStep::BULK_SIZE); |
||
| 491 | $dataSetStepBroker |
||
| 492 | ->addStep(new TaxWriterStep($this->createCountryRepository())); |
||
| 493 | |||
| 494 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 495 | |||
| 496 | return $dataImporter; |
||
| 497 | } |
||
| 498 | |||
| 499 | public function createCountryRepository(): CountryRepositoryInterface |
||
| 500 | { |
||
| 501 | return new CountryRepository(); |
||
| 502 | } |
||
| 503 | |||
| 504 | public function createNavigationImporter( |
||
| 505 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 506 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 507 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 508 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 509 | ); |
||
| 510 | |||
| 511 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(NavigationWriterStep::BULK_SIZE); |
||
| 512 | $dataSetStepBroker |
||
| 513 | ->addStep(new NavigationWriterStep()); |
||
| 514 | |||
| 515 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 516 | |||
| 517 | return $dataImporter; |
||
| 518 | } |
||
| 519 | |||
| 520 | public function createNavigationNodeImporter( |
||
| 521 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 522 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 523 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 524 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 525 | ); |
||
| 526 | |||
| 527 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(NavigationNodeWriterStep::BULK_SIZE); |
||
| 528 | $dataSetStepBroker |
||
| 529 | ->addStep($this->createAddLocalesStep()) |
||
| 530 | ->addStep($this->createNavigationKeyToIdNavigationStep(NavigationNodeWriterStep::KEY_NAVIGATION_KEY)) |
||
| 531 | ->addStep($this->createLocalizedAttributesExtractorStep([ |
||
| 532 | NavigationNodeWriterStep::KEY_TITLE, |
||
| 533 | NavigationNodeWriterStep::KEY_URL, |
||
| 534 | NavigationNodeWriterStep::KEY_CSS_CLASS, |
||
| 535 | ])) |
||
| 536 | ->addStep($this->createNavigationNodeValidityDatesStep(NavigationNodeWriterStep::KEY_VALID_FROM, NavigationNodeWriterStep::KEY_VALID_TO)) |
||
| 537 | ->addStep(new NavigationNodeWriterStep()); |
||
| 538 | |||
| 539 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 540 | |||
| 541 | return $dataImporter; |
||
| 542 | } |
||
| 543 | |||
| 544 | public function createNavigationKeyToIdNavigationStep( |
||
| 545 | string $source = NavigationKeyToIdNavigationStep::KEY_SOURCE, |
||
| 546 | string $target = NavigationKeyToIdNavigationStep::KEY_TARGET, |
||
| 547 | ): NavigationKeyToIdNavigationStep { |
||
| 548 | return new NavigationKeyToIdNavigationStep($source, $target); |
||
| 549 | } |
||
| 550 | |||
| 551 | public function createNavigationNodeValidityDatesStep( |
||
| 552 | string $keyValidFrom, |
||
| 553 | string $keyValidTo, |
||
| 554 | ): NavigationNodeValidityDatesStep { |
||
| 555 | return new NavigationNodeValidityDatesStep($keyValidFrom, $keyValidTo); |
||
| 556 | } |
||
| 557 | |||
| 558 | public function createProductAbstractImporter( |
||
| 559 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 560 | ): DataImporterInterface { |
||
| 561 | /** @var \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface|\Spryker\Zed\DataImport\Business\Model\DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareInterface $dataImporter */ |
||
| 562 | $dataImporter = $this->getCsvDataImporterWriterAwareFromConfig( |
||
| 563 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 564 | ); |
||
| 565 | |||
| 566 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductAbstractHydratorStep::BULK_SIZE); |
||
| 567 | $dataSetStepBroker |
||
| 568 | ->addStep($this->createProductAbstractCheckExistenceStep()) |
||
| 569 | ->addStep($this->createAddLocalesStep()) |
||
| 570 | ->addStep($this->createAddCategoryKeysStep()) |
||
| 571 | ->addStep($this->createTaxSetNameToIdTaxSetStep(ProductAbstractHydratorStep::COLUMN_TAX_SET_NAME)) |
||
| 572 | ->addStep($this->createAttributesExtractorStep()) |
||
| 573 | ->addStep($this->createProductLocalizedAttributesExtractorStep([ |
||
| 574 | ProductAbstractHydratorStep::COLUMN_NAME, |
||
| 575 | ProductAbstractHydratorStep::COLUMN_URL, |
||
| 576 | ProductAbstractHydratorStep::COLUMN_DESCRIPTION, |
||
| 577 | ProductAbstractHydratorStep::COLUMN_META_TITLE, |
||
| 578 | ProductAbstractHydratorStep::COLUMN_META_DESCRIPTION, |
||
| 579 | ProductAbstractHydratorStep::COLUMN_META_KEYWORDS, |
||
| 580 | ])) |
||
| 581 | ->addStep(new ProductAbstractHydratorStep()); |
||
| 582 | |||
| 583 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 584 | $dataImporter->setDataSetWriter($this->createProductAbstractDataImportWriters()); |
||
| 585 | |||
| 586 | return $dataImporter; |
||
| 587 | } |
||
| 588 | |||
| 589 | public function createProductAbstractStoreImporter( |
||
| 590 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 591 | ): DataImporterInterface { |
||
| 592 | /** @var \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface|\Spryker\Zed\DataImport\Business\Model\DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareInterface $dataImporter */ |
||
| 593 | $dataImporter = $this->getCsvDataImporterWriterAwareFromConfig( |
||
| 594 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 595 | ); |
||
| 596 | |||
| 597 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductAbstractStoreHydratorStep::BULK_SIZE); |
||
| 598 | $dataSetStepBroker->addStep(new ProductAbstractStoreHydratorStep()); |
||
| 599 | |||
| 600 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 601 | $dataImporter->setDataSetWriter($this->createProductAbstractStoreDataImportWriters()); |
||
| 602 | |||
| 603 | return $dataImporter; |
||
| 604 | } |
||
| 605 | |||
| 606 | public function createProductConcreteImporter( |
||
| 607 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 608 | ): DataImporterInterface { |
||
| 609 | /** @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 */ |
||
| 610 | $dataImporter = $this->getCsvDataImporterWriterAwareFromConfig( |
||
| 611 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 612 | ); |
||
| 613 | |||
| 614 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductConcreteHydratorStep::BULK_SIZE); |
||
| 615 | $dataSetStepBroker |
||
| 616 | ->addStep($this->createProductConcreteCheckExistenceStep()) |
||
| 617 | ->addStep($this->createAddLocalesStep()) |
||
| 618 | ->addStep($this->createAttributesExtractorStep()) |
||
| 619 | ->addStep($this->createProductConcreteAttributesUniqueCheckStep()) |
||
| 620 | ->addStep($this->createProductLocalizedAttributesExtractorStep([ |
||
| 621 | ProductConcreteHydratorStep::COLUMN_NAME, |
||
| 622 | ProductConcreteHydratorStep::COLUMN_DESCRIPTION, |
||
| 623 | ProductConcreteHydratorStep::COLUMN_IS_SEARCHABLE, |
||
| 624 | ])) |
||
| 625 | ->addStep(new ProductConcreteHydratorStep( |
||
| 626 | $this->createProductRepository(), |
||
| 627 | )); |
||
| 628 | |||
| 629 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 630 | $dataImporter->setDataSetWriter($this->createProductConcreteDataImportWriters()); |
||
| 631 | |||
| 632 | return $dataImporter; |
||
| 633 | } |
||
| 634 | |||
| 635 | public function createProductConcreteAttributesUniqueCheckStep(): DataImportStepInterface |
||
| 636 | { |
||
| 637 | return new ProductConcreteAttributesUniqueCheckStep( |
||
| 638 | $this->createProductRepository(), |
||
| 639 | $this->getUtilEncodingService(), |
||
| 640 | $this->getConfig(), |
||
| 641 | ); |
||
| 642 | } |
||
| 643 | |||
| 644 | public function createProductRepository(): ProductRepository |
||
| 645 | { |
||
| 646 | return new ProductRepository(); |
||
| 647 | } |
||
| 648 | |||
| 649 | public function createProductAttributeKeyImporter( |
||
| 650 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 651 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 652 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 653 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 654 | ); |
||
| 655 | |||
| 656 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
| 657 | $dataSetStepBroker |
||
| 658 | ->addStep(new ProductAttributeKeyWriter()); |
||
| 659 | |||
| 660 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 661 | |||
| 662 | return $dataImporter; |
||
| 663 | } |
||
| 664 | |||
| 665 | public function createProductManagementAttributeImporter( |
||
| 666 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 667 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 668 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 669 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 670 | ); |
||
| 671 | |||
| 672 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
| 673 | $dataSetStepBroker |
||
| 674 | ->addStep($this->createAddLocalesStep()) |
||
| 675 | ->addStep($this->createAddProductAttributeKeysStep()) |
||
| 676 | ->addStep($this->createProductManagementLocalizedAttributesExtractorStep()) |
||
| 677 | ->addStep(new ProductManagementAttributeWriter()); |
||
| 678 | |||
| 679 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 680 | |||
| 681 | return $dataImporter; |
||
| 682 | } |
||
| 683 | |||
| 684 | public function createProductManagementLocalizedAttributesExtractorStep(): ProductManagementLocalizedAttributesExtractorStep |
||
| 685 | { |
||
| 686 | return new ProductManagementLocalizedAttributesExtractorStep(); |
||
| 687 | } |
||
| 688 | |||
| 689 | public function createProductGroupImporter( |
||
| 690 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 691 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 692 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 693 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 694 | ); |
||
| 695 | |||
| 696 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductGroupWriter::BULK_SIZE); |
||
| 697 | $dataSetStepBroker |
||
| 698 | ->addStep(new ProductGroupWriter( |
||
| 699 | $this->createProductRepository(), |
||
| 700 | )); |
||
| 701 | |||
| 702 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 703 | |||
| 704 | return $dataImporter; |
||
| 705 | } |
||
| 706 | |||
| 707 | public function createProductReviewImporter( |
||
| 708 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 709 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 710 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 711 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 712 | ); |
||
| 713 | |||
| 714 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
| 715 | $dataSetStepBroker->addStep(new ProductReviewWriterStep( |
||
| 716 | $this->createProductRepository(), |
||
| 717 | $this->createLocaleRepository(), |
||
| 718 | )); |
||
| 719 | |||
| 720 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 721 | |||
| 722 | return $dataImporter; |
||
| 723 | } |
||
| 724 | |||
| 725 | public function createProductSetImporter( |
||
| 726 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 727 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 728 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 729 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 730 | ); |
||
| 731 | |||
| 732 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
| 733 | $dataSetStepBroker |
||
| 734 | ->addStep($this->createAddProductAbstractSkusStep()) |
||
| 735 | ->addStep($this->createAddLocalesStep()) |
||
| 736 | ->addStep($this->createProductSetImageExtractorStep()) |
||
| 737 | ->addStep($this->createProductSetImageLocalizedAttributesExtractorStep()) |
||
| 738 | ->addStep($this->createLocalizedAttributesExtractorStep([ |
||
| 739 | ProductSetWriterStep::KEY_NAME, |
||
| 740 | ProductSetWriterStep::KEY_URL, |
||
| 741 | ProductSetWriterStep::KEY_DESCRIPTION, |
||
| 742 | ProductSetWriterStep::KEY_META_TITLE, |
||
| 743 | ProductSetWriterStep::KEY_META_DESCRIPTION, |
||
| 744 | ProductSetWriterStep::KEY_META_KEYWORDS, |
||
| 745 | ])) |
||
| 746 | ->addStep(new ProductSetWriterStep( |
||
| 747 | $this->createProductRepository(), |
||
| 748 | )); |
||
| 749 | |||
| 750 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 751 | |||
| 752 | return $dataImporter; |
||
| 753 | } |
||
| 754 | |||
| 755 | public function createProductSetImageExtractorStep(): ProductSetImageExtractorStep |
||
| 756 | { |
||
| 757 | return new ProductSetImageExtractorStep(); |
||
| 758 | } |
||
| 759 | |||
| 760 | protected function createProductSetImageLocalizedAttributesExtractorStep(): ProductSetImageLocalizedAttributesExtractorStep |
||
| 761 | { |
||
| 762 | return new ProductSetImageLocalizedAttributesExtractorStep(); |
||
| 763 | } |
||
| 764 | |||
| 765 | public function createProductSearchAttributeMapImporter( |
||
| 766 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 767 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 768 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 769 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 770 | ); |
||
| 771 | |||
| 772 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
| 773 | $dataSetStepBroker |
||
| 774 | ->addStep($this->createAddProductAttributeKeysStep()) |
||
| 775 | ->addStep(new ProductSearchAttributeMapWriter()); |
||
| 776 | |||
| 777 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 778 | |||
| 779 | return $dataImporter; |
||
| 780 | } |
||
| 781 | |||
| 782 | public function createProductSearchAttributeImporter( |
||
| 783 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 784 | ): DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface { |
||
| 785 | $dataImporter = $this->getCsvDataImporterFromConfig( |
||
| 786 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 787 | ); |
||
| 788 | |||
| 789 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); |
||
| 790 | $dataSetStepBroker |
||
| 791 | ->addStep($this->createAddLocalesStep()) |
||
| 792 | ->addStep($this->createAddProductAttributeKeysStep()) |
||
| 793 | ->addStep($this->createLocalizedAttributesExtractorStep([ProductSearchAttributeWriter::KEY])) |
||
| 794 | ->addStep(new ProductSearchAttributeWriter( |
||
| 795 | $this->createSearchGlossaryKeyBuilder(), |
||
| 796 | )); |
||
| 797 | |||
| 798 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 799 | $dataImporter->addAfterImportHook($this->createProductSearchAfterImportHook()); |
||
| 800 | |||
| 801 | return $dataImporter; |
||
| 802 | } |
||
| 803 | |||
| 804 | public function createProductSearchAfterImportHook(): ProductSearchAfterImportHook |
||
| 805 | { |
||
| 806 | return new ProductSearchAfterImportHook(); |
||
| 807 | } |
||
| 808 | |||
| 809 | public function createSearchGlossaryKeyBuilder(): FilterGlossaryKeyBuilder |
||
| 810 | { |
||
| 811 | return new FilterGlossaryKeyBuilder(); |
||
| 812 | } |
||
| 813 | |||
| 814 | public function createAddCategoryKeysStep(): AddCategoryKeysStep |
||
| 815 | { |
||
| 816 | return new AddCategoryKeysStep(); |
||
| 817 | } |
||
| 818 | |||
| 819 | public function createAttributesExtractorStep(): AttributesExtractorStep |
||
| 820 | { |
||
| 821 | return new AttributesExtractorStep(); |
||
| 822 | } |
||
| 823 | |||
| 824 | /** |
||
| 825 | * @param array<string> $defaultAttributes |
||
| 826 | */ |
||
| 827 | public function createProductLocalizedAttributesExtractorStep( |
||
| 828 | array $defaultAttributes = [], |
||
| 829 | ): ProductLocalizedAttributesExtractorStep { |
||
| 830 | return new ProductLocalizedAttributesExtractorStep($defaultAttributes); |
||
| 831 | } |
||
| 832 | |||
| 833 | public function createAddProductAbstractSkusStep(): AddProductAbstractSkusStep |
||
| 834 | { |
||
| 835 | return new AddProductAbstractSkusStep(); |
||
| 836 | } |
||
| 837 | |||
| 838 | public function createLocaleNameToIdStep( |
||
| 839 | string $source = LocaleNameToIdLocaleStep::KEY_SOURCE, |
||
| 840 | string $target = LocaleNameToIdLocaleStep::KEY_TARGET, |
||
| 841 | ): LocaleNameToIdLocaleStep { |
||
| 842 | return new LocaleNameToIdLocaleStep($source, $target); |
||
| 843 | } |
||
| 844 | |||
| 845 | public function createTaxSetNameToIdTaxSetStep( |
||
| 846 | string $source = TaxSetNameToIdTaxSetStep::KEY_SOURCE, |
||
| 847 | string $target = TaxSetNameToIdTaxSetStep::KEY_TARGET, |
||
| 848 | ): TaxSetNameToIdTaxSetStep { |
||
| 849 | return new TaxSetNameToIdTaxSetStep($source, $target); |
||
| 850 | } |
||
| 851 | |||
| 852 | public function createAddProductAttributeKeysStep(): AddProductAttributeKeysStep |
||
| 853 | { |
||
| 854 | return new AddProductAttributeKeysStep(); |
||
| 855 | } |
||
| 856 | |||
| 857 | public function getEventFacade(): EventFacadeInterface |
||
| 858 | { |
||
| 859 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_EVENT); |
||
| 860 | } |
||
| 861 | |||
| 862 | public function createAddLocalesStep(): DataImportStepInterface |
||
| 863 | { |
||
| 864 | return new AddLocalesStep($this->getDataImportStoreFacade()); |
||
| 865 | } |
||
| 866 | |||
| 867 | public function createDataImporterConditional(string $importType, DataReaderInterface $reader): DataImporterConditional |
||
| 868 | { |
||
| 869 | return new DataImporterConditional($importType, $reader, $this->getGracefulRunnerFacade()); |
||
| 870 | } |
||
| 871 | |||
| 872 | /** |
||
| 873 | * @param string $importType |
||
| 874 | * @param \Spryker\Zed\DataImport\Business\Model\DataReader\DataReaderInterface $reader |
||
| 875 | * |
||
| 876 | * @return \Pyz\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareConditional |
||
| 877 | */ |
||
| 878 | public function createDataImporterWriterAwareConditional(string $importType, DataReaderInterface $reader): DataImporterDataSetWriterAwareInterface |
||
| 879 | { |
||
| 880 | return new DataImporterDataSetWriterAwareConditional($importType, $reader, $this->getGracefulRunnerFacade()); |
||
| 881 | } |
||
| 882 | |||
| 883 | public function getConditionalCsvDataImporterFromConfig( |
||
| 884 | DataImporterConfigurationTransfer $dataImporterConfigurationTransfer, |
||
| 885 | ): DataImporterConditional { |
||
| 886 | $csvReader = $this->createCsvReaderFromConfig($dataImporterConfigurationTransfer->getReaderConfiguration()); |
||
| 887 | |||
| 888 | return $this->createDataImporterConditional($dataImporterConfigurationTransfer->getImportType(), $csvReader); |
||
| 889 | } |
||
| 890 | |||
| 891 | /** |
||
| 892 | * @param \Generated\Shared\Transfer\DataImporterConfigurationTransfer $dataImporterConfigurationTransfer |
||
| 893 | * |
||
| 894 | * @return \Pyz\Zed\DataImport\Business\Model\DataImporterDataSetWriterAwareConditional |
||
| 895 | */ |
||
| 896 | public function getConditionalCsvDataImporterWriterAwareFromConfig( |
||
| 897 | DataImporterConfigurationTransfer $dataImporterConfigurationTransfer, |
||
| 898 | ): DataImporterDataSetWriterAwareInterface { |
||
| 899 | $csvReader = $this->createCsvReaderFromConfig($dataImporterConfigurationTransfer->getReaderConfiguration()); |
||
| 900 | |||
| 901 | return $this->createDataImporterWriterAwareConditional($dataImporterConfigurationTransfer->getImportType(), $csvReader); |
||
| 902 | } |
||
| 903 | |||
| 904 | public function createCombinedProductPricePropelDataSetWriter(): DataSetWriterInterface |
||
| 905 | { |
||
| 906 | return new CombinedProductPricePropelDataSetWriter( |
||
| 907 | $this->createProductRepository(), |
||
| 908 | $this->getStoreFacade(), |
||
| 909 | $this->getCurrencyFacade(), |
||
| 910 | ); |
||
| 911 | } |
||
| 912 | |||
| 913 | public function createCombinedProductImagePropelDataSetWriter(): DataSetWriterInterface |
||
| 914 | { |
||
| 915 | return new CombinedProductImagePropelDataSetWriter( |
||
| 916 | $this->createProductImageRepository(), |
||
| 917 | ); |
||
| 918 | } |
||
| 919 | |||
| 920 | public function createCombinedProductStockPropelDataSetWriter(): DataSetWriterInterface |
||
| 921 | { |
||
| 922 | return new CombinedProductStockPropelDataSetWriter( |
||
| 923 | $this->getProductBundleFacade(), |
||
| 924 | $this->createProductRepository(), |
||
| 925 | $this->getStoreFacade(), |
||
| 926 | $this->getStockFacade(), |
||
| 927 | ); |
||
| 928 | } |
||
| 929 | |||
| 930 | public function createCombinedProductAbstractStorePropelDataSetWriter(): DataSetWriterInterface |
||
| 931 | { |
||
| 932 | return new CombinedProductAbstractStorePropelDataSetWriter(); |
||
| 933 | } |
||
| 934 | |||
| 935 | public function createCombinedProductAbstractPropelDataSetWriter(): DataSetWriterInterface |
||
| 936 | { |
||
| 937 | return new CombinedProductAbstractPropelDataSetWriter( |
||
| 938 | $this->createProductRepository(), |
||
| 939 | ); |
||
| 940 | } |
||
| 941 | |||
| 942 | public function createCombinedProductConcretePropelDataSetWriter(): DataSetWriterInterface |
||
| 943 | { |
||
| 944 | return new CombinedProductConcretePropelDataSetWriter( |
||
| 945 | $this->createProductRepository(), |
||
| 946 | ); |
||
| 947 | } |
||
| 948 | |||
| 949 | public function createCombinedProductPriceImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
| 950 | { |
||
| 951 | $dataImporter = $this->getConditionalCsvDataImporterWriterAwareFromConfig( |
||
| 952 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 953 | ); |
||
| 954 | |||
| 955 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CombinedProductPriceHydratorStep::BULK_SIZE); |
||
| 956 | $dataSetStepBroker |
||
| 957 | ->addStep(new CombinedProductPriceHydratorStep( |
||
| 958 | $this->getPriceProductFacade(), |
||
| 959 | $this->getUtilEncodingService(), |
||
| 960 | )); |
||
| 961 | |||
| 962 | $dataImporter->setDataSetCondition($this->createCombinedProductPriceMandatoryColumnCondition()); |
||
| 963 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 964 | $dataImporter->setDataSetWriter($this->createCombinedProductPriceDataSetWriters()); |
||
| 965 | |||
| 966 | return $dataImporter; |
||
| 967 | } |
||
| 968 | |||
| 969 | public function getCurrencyFacade(): CurrencyFacadeInterface |
||
| 970 | { |
||
| 971 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_CURRENCY); |
||
| 972 | } |
||
| 973 | |||
| 974 | public function getPriceProductFacade(): PriceProductFacadeInterface |
||
| 975 | { |
||
| 976 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_PRICE_PRODUCT); |
||
| 977 | } |
||
| 978 | |||
| 979 | public function getStockFacade(): StockFacadeInterface |
||
| 980 | { |
||
| 981 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_STOCK); |
||
| 982 | } |
||
| 983 | |||
| 984 | public function getStoreFacade(): StoreFacadeInterface |
||
| 985 | { |
||
| 986 | return $this->getProvidedDependency(DataImportDependencyProvider::FACADE_STORE); |
||
| 987 | } |
||
| 988 | |||
| 989 | public function createProductStockDataImportWriters(): DataSetWriterInterface |
||
| 990 | { |
||
| 991 | return new DataSetWriterCollection($this->createProductStockWriterPlugins()); |
||
| 992 | } |
||
| 993 | |||
| 994 | /** |
||
| 995 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
| 996 | */ |
||
| 997 | public function createProductStockWriterPlugins(): array |
||
| 998 | { |
||
| 999 | return [ |
||
| 1000 | new ProductStockPropelWriterPlugin(), |
||
| 1001 | ]; |
||
| 1002 | } |
||
| 1003 | |||
| 1004 | public function createCombinedProductPriceMandatoryColumnCondition(): DataSetConditionInterface |
||
| 1005 | { |
||
| 1006 | return new CombinedProductPriceMandatoryColumnCondition(); |
||
| 1007 | } |
||
| 1008 | |||
| 1009 | public function createProductImageRepository(): ProductImageRepositoryInterface |
||
| 1010 | { |
||
| 1011 | return new ProductImageRepository(); |
||
| 1012 | } |
||
| 1013 | |||
| 1014 | public function createCombinedProductPriceDataSetWriters(): DataSetWriterInterface |
||
| 1015 | { |
||
| 1016 | return new DataSetWriterCollection($this->createCombinedProductPriceDataSetWriterPlugins()); |
||
| 1017 | } |
||
| 1018 | |||
| 1019 | /** |
||
| 1020 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
| 1021 | */ |
||
| 1022 | public function createCombinedProductPriceDataSetWriterPlugins(): array |
||
| 1023 | { |
||
| 1024 | return [ |
||
| 1025 | new CombinedProductPricePropelWriterPlugin(), |
||
| 1026 | ]; |
||
| 1027 | } |
||
| 1028 | |||
| 1029 | public function createCombinedProductImageImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
| 1052 | } |
||
| 1053 | |||
| 1054 | public function createCombinedProductImageMandatoryColumnCondition(): DataSetConditionInterface |
||
| 1055 | { |
||
| 1056 | return new CombinedProductImageMandatoryColumnCondition(); |
||
| 1057 | } |
||
| 1058 | |||
| 1059 | public function createCombinedProductImageDataSetWriters(): DataSetWriterInterface |
||
| 1060 | { |
||
| 1061 | return new DataSetWriterCollection($this->createCombinedProductImageDataSetWriterPlugins()); |
||
| 1062 | } |
||
| 1063 | |||
| 1064 | /** |
||
| 1065 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
| 1066 | */ |
||
| 1067 | public function createCombinedProductImageDataSetWriterPlugins(): array |
||
| 1068 | { |
||
| 1069 | return [ |
||
| 1070 | new CombinedProductImagePropelWriterPlugin(), |
||
| 1071 | ]; |
||
| 1072 | } |
||
| 1073 | |||
| 1074 | public function createCombinedProductStockImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
| 1075 | { |
||
| 1076 | $dataImporter = $this->getConditionalCsvDataImporterWriterAwareFromConfig( |
||
| 1077 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 1078 | ); |
||
| 1079 | |||
| 1080 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CombinedProductStockHydratorStep::BULK_SIZE); |
||
| 1081 | $dataSetStepBroker |
||
| 1082 | ->addStep(new CombinedProductStockHydratorStep()); |
||
| 1083 | |||
| 1084 | $dataImporter->setDataSetCondition($this->createCombinedProductStockMandatoryColumnCondition()); |
||
| 1085 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 1086 | $dataImporter->setDataSetWriter($this->createCombinedProductStockDataSetWriters()); |
||
| 1087 | |||
| 1088 | return $dataImporter; |
||
| 1089 | } |
||
| 1090 | |||
| 1091 | public function createCombinedProductStockMandatoryColumnCondition(): DataSetConditionInterface |
||
| 1092 | { |
||
| 1093 | return new CombinedProductStockMandatoryColumnCondition(); |
||
| 1094 | } |
||
| 1095 | |||
| 1096 | public function createCombinedProductStockDataSetWriters(): DataSetWriterInterface |
||
| 1097 | { |
||
| 1098 | return new DataSetWriterCollection($this->createCombinedProductStockDataSetWriterPlugins()); |
||
| 1099 | } |
||
| 1100 | |||
| 1101 | /** |
||
| 1102 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
| 1103 | */ |
||
| 1104 | public function createCombinedProductStockDataSetWriterPlugins(): array |
||
| 1105 | { |
||
| 1106 | return [ |
||
| 1107 | new CombinedProductStockPropelWriterPlugin(), |
||
| 1108 | ]; |
||
| 1109 | } |
||
| 1110 | |||
| 1111 | public function createCombinedProductAbstractStoreImporter( |
||
| 1112 | DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer, |
||
| 1113 | ): DataImporterInterface { |
||
| 1114 | $dataImporter = $this->getConditionalCsvDataImporterWriterAwareFromConfig( |
||
| 1115 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 1116 | ); |
||
| 1117 | |||
| 1118 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CombinedProductAbstractStoreHydratorStep::BULK_SIZE); |
||
| 1119 | $dataSetStepBroker->addStep(new CombinedProductAbstractStoreHydratorStep()); |
||
| 1120 | |||
| 1121 | $dataImporter->setDataSetCondition($this->createCombinedProductAbstractStoreMandatoryColumnCondition()); |
||
| 1122 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 1123 | $dataImporter->setDataSetWriter($this->createCombinedProductAbstractStoreDataSetWriters()); |
||
| 1124 | |||
| 1125 | return $dataImporter; |
||
| 1126 | } |
||
| 1127 | |||
| 1128 | public function createCombinedProductAbstractStoreMandatoryColumnCondition(): DataSetConditionInterface |
||
| 1129 | { |
||
| 1130 | return new CombinedProductAbstractStoreMandatoryColumnCondition(); |
||
| 1131 | } |
||
| 1132 | |||
| 1133 | public function createCombinedProductAbstractStoreDataSetWriters(): DataSetWriterInterface |
||
| 1134 | { |
||
| 1135 | return new DataSetWriterCollection($this->createCombinedProductAbstractStoreDataSetWriterPlugins()); |
||
| 1136 | } |
||
| 1137 | |||
| 1138 | /** |
||
| 1139 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
| 1140 | */ |
||
| 1141 | public function createCombinedProductAbstractStoreDataSetWriterPlugins(): array |
||
| 1142 | { |
||
| 1143 | return [ |
||
| 1144 | new CombinedProductAbstractStorePropelWriterPlugin(), |
||
| 1145 | ]; |
||
| 1146 | } |
||
| 1147 | |||
| 1148 | public function createCombinedProductAbstractImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
| 1149 | { |
||
| 1150 | $dataImporter = $this->getConditionalCsvDataImporterWriterAwareFromConfig( |
||
| 1151 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 1152 | ); |
||
| 1153 | |||
| 1154 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CombinedProductAbstractHydratorStep::BULK_SIZE); |
||
| 1155 | $dataSetStepBroker |
||
| 1156 | ->addStep($this->createProductAbstractCheckExistenceStep()) |
||
| 1157 | ->addStep($this->createAddLocalesStep()) |
||
| 1158 | ->addStep($this->createAddCategoryKeysStep()) |
||
| 1159 | ->addStep($this->createTaxSetNameToIdTaxSetStep(CombinedProductAbstractHydratorStep::COLUMN_TAX_SET_NAME)) |
||
| 1160 | ->addStep($this->createCombinedAttributesExtractorStep()) |
||
| 1161 | ->addStep($this->createCombinedProductLocalizedAttributesExtractorStep([ |
||
| 1162 | CombinedProductAbstractHydratorStep::COLUMN_NAME, |
||
| 1163 | CombinedProductAbstractHydratorStep::COLUMN_URL, |
||
| 1164 | CombinedProductAbstractHydratorStep::COLUMN_DESCRIPTION, |
||
| 1165 | CombinedProductAbstractHydratorStep::COLUMN_META_TITLE, |
||
| 1166 | CombinedProductAbstractHydratorStep::COLUMN_META_DESCRIPTION, |
||
| 1167 | CombinedProductAbstractHydratorStep::COLUMN_META_KEYWORDS, |
||
| 1168 | ])) |
||
| 1169 | ->addStep(new CombinedProductAbstractHydratorStep()); |
||
| 1170 | |||
| 1171 | $dataImporter->setDataSetCondition($this->createCombinedProductAbstractTypeDataSetCondition()); |
||
| 1172 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 1173 | $dataImporter->setDataSetWriter($this->createCombinedProductAbstractDataSetWriters()); |
||
| 1174 | |||
| 1175 | return $dataImporter; |
||
| 1176 | } |
||
| 1177 | |||
| 1178 | public function createCombinedProductAbstractTypeDataSetCondition(): DataSetConditionInterface |
||
| 1179 | { |
||
| 1180 | return new CombinedProductAbstractTypeDataSetCondition(); |
||
| 1181 | } |
||
| 1182 | |||
| 1183 | public function createCombinedProductAbstractDataSetWriters(): DataSetWriterInterface |
||
| 1184 | { |
||
| 1185 | return new DataSetWriterCollection($this->createCombinedProductAbstractDataSetWriterPlugins()); |
||
| 1186 | } |
||
| 1187 | |||
| 1188 | /** |
||
| 1189 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
| 1190 | */ |
||
| 1191 | public function createCombinedProductAbstractDataSetWriterPlugins(): array |
||
| 1192 | { |
||
| 1193 | return [ |
||
| 1194 | new CombinedProductAbstractPropelWriterPlugin(), |
||
| 1195 | ]; |
||
| 1196 | } |
||
| 1197 | |||
| 1198 | public function createCombinedProductConcreteImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
| 1199 | { |
||
| 1200 | $dataImporter = $this->getConditionalCsvDataImporterWriterAwareFromConfig( |
||
| 1201 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 1202 | ); |
||
| 1203 | |||
| 1204 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(CombinedProductConcreteHydratorStep::BULK_SIZE); |
||
| 1205 | $dataSetStepBroker |
||
| 1206 | ->addStep($this->createProductConcreteCheckExistenceStep()) |
||
| 1207 | ->addStep($this->createAddLocalesStep()) |
||
| 1208 | ->addStep($this->createCombinedAttributesExtractorStep()) |
||
| 1209 | ->addStep($this->createProductConcreteAttributesUniqueCheckStep()) |
||
| 1210 | ->addStep($this->createCombinedProductLocalizedAttributesExtractorStep([ |
||
| 1211 | CombinedProductConcreteHydratorStep::COLUMN_NAME, |
||
| 1212 | CombinedProductConcreteHydratorStep::COLUMN_DESCRIPTION, |
||
| 1213 | CombinedProductConcreteHydratorStep::COLUMN_IS_SEARCHABLE, |
||
| 1214 | ])) |
||
| 1215 | ->addStep(new CombinedProductConcreteHydratorStep( |
||
| 1216 | $this->createProductRepository(), |
||
| 1217 | )); |
||
| 1218 | |||
| 1219 | $dataImporter->setDataSetCondition($this->createCombinedProductConcreteTypeDataSetCondition()); |
||
| 1220 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 1221 | $dataImporter->setDataSetWriter($this->createCombinedProductConcreteDataSetWriters()); |
||
| 1222 | |||
| 1223 | return $dataImporter; |
||
| 1224 | } |
||
| 1225 | |||
| 1226 | public function createCombinedProductConcreteTypeDataSetCondition(): DataSetConditionInterface |
||
| 1227 | { |
||
| 1228 | return new CombinedProductConcreteTypeDataSetCondition(); |
||
| 1229 | } |
||
| 1230 | |||
| 1231 | public function createCombinedProductConcreteDataSetWriters(): DataSetWriterInterface |
||
| 1232 | { |
||
| 1233 | return new DataSetWriterCollection($this->createCombinedProductConcreteDataSetWriterPlugins()); |
||
| 1234 | } |
||
| 1235 | |||
| 1236 | /** |
||
| 1237 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
| 1238 | */ |
||
| 1239 | public function createCombinedProductConcreteDataSetWriterPlugins(): array |
||
| 1240 | { |
||
| 1241 | return [ |
||
| 1242 | new CombinedProductConcretePropelWriterPlugin(), |
||
| 1243 | ]; |
||
| 1244 | } |
||
| 1245 | |||
| 1246 | public function createCombinedProductGroupImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): DataImporterInterface |
||
| 1247 | { |
||
| 1248 | $dataImporter = $this->getConditionalCsvDataImporterFromConfig( |
||
| 1249 | $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer), |
||
| 1250 | ); |
||
| 1251 | |||
| 1252 | $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(ProductGroupWriter::BULK_SIZE); |
||
| 1253 | $dataSetStepBroker |
||
| 1254 | ->addStep(new CombinedProductGroupWriter($this->createProductRepository())); |
||
| 1255 | |||
| 1256 | $dataImporter->setDataSetCondition($this->createCombinedProductGroupMandatoryColumnCondition()); |
||
| 1257 | $dataImporter->addDataSetStepBroker($dataSetStepBroker); |
||
| 1258 | |||
| 1259 | return $dataImporter; |
||
| 1260 | } |
||
| 1261 | |||
| 1262 | public function createCombinedProductGroupMandatoryColumnCondition(): DataSetConditionInterface |
||
| 1263 | { |
||
| 1264 | return new CombinedProductGroupMandatoryColumnCondition(); |
||
| 1265 | } |
||
| 1266 | |||
| 1267 | /** |
||
| 1268 | * @param string $source |
||
| 1269 | * @param string $target |
||
| 1270 | * |
||
| 1271 | * @return \Pyz\Zed\DataImport\Business\Model\ProductAbstract\ProductAbstractSkuToIdProductAbstractStep |
||
| 1272 | */ |
||
| 1273 | public function createProductAbstractSkuToIdProductAbstractStep( |
||
| 1274 | string $source = ProductAbstractSkuToIdProductAbstractStep::KEY_SOURCE, |
||
| 1275 | string $target = ProductAbstractSkuToIdProductAbstractStep::KEY_TARGET, |
||
| 1276 | ): DataImportStepInterface { |
||
| 1277 | return new ProductAbstractSkuToIdProductAbstractStep($source, $target); |
||
| 1278 | } |
||
| 1279 | |||
| 1280 | /** |
||
| 1281 | * @param string $source |
||
| 1282 | * @param string $target |
||
| 1283 | * |
||
| 1284 | * @return \Pyz\Zed\DataImport\Business\Model\ProductConcrete\ProductSkuToIdProductStep |
||
| 1285 | */ |
||
| 1286 | public function createProductSkuToIdProductStep( |
||
| 1287 | string $source = ProductSkuToIdProductStep::KEY_SOURCE, |
||
| 1288 | string $target = ProductSkuToIdProductStep::KEY_TARGET, |
||
| 1289 | ): DataImportStepInterface { |
||
| 1290 | return new ProductSkuToIdProductStep($source, $target); |
||
| 1291 | } |
||
| 1292 | |||
| 1293 | public function createProductAbstractCheckExistenceStep(): DataImportStepInterface |
||
| 1294 | { |
||
| 1295 | return new ProductAbstractCheckExistenceStep( |
||
| 1296 | $this->createProductRepository(), |
||
| 1297 | ); |
||
| 1298 | } |
||
| 1299 | |||
| 1300 | public function createProductConcreteCheckExistenceStep(): DataImportStepInterface |
||
| 1301 | { |
||
| 1302 | return new ProductConcreteCheckExistenceStep( |
||
| 1303 | $this->createProductRepository(), |
||
| 1304 | ); |
||
| 1305 | } |
||
| 1306 | |||
| 1307 | public function createProductAbstractDataImportWriters(): DataSetWriterInterface |
||
| 1308 | { |
||
| 1309 | return new DataSetWriterCollection($this->createProductAbstractWriterPlugins()); |
||
| 1310 | } |
||
| 1311 | |||
| 1312 | /** |
||
| 1313 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
| 1314 | */ |
||
| 1315 | public function createProductAbstractWriterPlugins(): array |
||
| 1316 | { |
||
| 1317 | return [ |
||
| 1318 | new ProductAbstractPropelWriterPlugin(), |
||
| 1319 | ]; |
||
| 1320 | } |
||
| 1321 | |||
| 1322 | public function createProductConcreteDataImportWriters(): DataSetWriterInterface |
||
| 1323 | { |
||
| 1324 | return new DataSetWriterCollection($this->createProductConcreteWriterPlugins()); |
||
| 1325 | } |
||
| 1326 | |||
| 1327 | /** |
||
| 1328 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
| 1329 | */ |
||
| 1330 | public function createProductConcreteWriterPlugins(): array |
||
| 1331 | { |
||
| 1332 | return [ |
||
| 1333 | new ProductConcretePropelWriterPlugin(), |
||
| 1334 | ]; |
||
| 1335 | } |
||
| 1336 | |||
| 1337 | public function createProductImageDataWriters(): DataSetWriterInterface |
||
| 1338 | { |
||
| 1339 | return new DataSetWriterCollection($this->createProductImageWriterPlugins()); |
||
| 1340 | } |
||
| 1341 | |||
| 1342 | /** |
||
| 1343 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
| 1344 | */ |
||
| 1345 | public function createProductImageWriterPlugins(): array |
||
| 1346 | { |
||
| 1347 | return [ |
||
| 1348 | new ProductImagePropelWriterPlugin(), |
||
| 1349 | ]; |
||
| 1350 | } |
||
| 1351 | |||
| 1352 | public function createProductAbstractStoreDataImportWriters(): DataSetWriterInterface |
||
| 1353 | { |
||
| 1354 | return new DataSetWriterCollection($this->createProductAbstractStoreWriterPlugins()); |
||
| 1355 | } |
||
| 1356 | |||
| 1357 | /** |
||
| 1358 | * @return array<\Spryker\Zed\DataImportExtension\Dependency\Plugin\DataSetWriterPluginInterface> |
||
| 1359 | */ |
||
| 1360 | public function createProductAbstractStoreWriterPlugins(): array |
||
| 1361 | { |
||
| 1362 | return [ |
||
| 1363 | new ProductAbstractStorePropelWriterPlugin(), |
||
| 1364 | ]; |
||
| 1365 | } |
||
| 1366 | |||
| 1367 | public function createProductAbstractPropelWriter(): DataSetWriterInterface |
||
| 1370 | } |
||
| 1371 | |||
| 1372 | public function createProductConcretePropelWriter(): DataSetWriterInterface |
||
| 1373 | { |
||
| 1374 | return new ProductConcretePropelDataSetWriter($this->createProductRepository()); |
||
| 1375 | } |
||
| 1376 | |||
| 1377 | public function createProductImagePropelWriter(): DataSetWriterInterface |
||
| 1378 | { |
||
| 1379 | return new ProductImagePropelDataSetWriter($this->createProductImageRepository()); |
||
| 1380 | } |
||
| 1381 | |||
| 1382 | public function createProductStockPropelWriter(): DataSetWriterInterface |
||
| 1383 | { |
||
| 1384 | return new ProductStockPropelDataSetWriter( |
||
| 1385 | $this->getProductBundleFacade(), |
||
| 1386 | $this->createProductRepository(), |
||
| 1387 | $this->getStoreFacade(), |
||
| 1388 | $this->getStockFacade(), |
||
| 1389 | ); |
||
| 1390 | } |
||
| 1391 | |||
| 1392 | public function createProductAbstractStorePropelWriter(): DataSetWriterInterface |
||
| 1393 | { |
||
| 1394 | return new ProductAbstractStorePropelDataSetWriter(); |
||
| 1395 | } |
||
| 1396 | |||
| 1397 | /** |
||
| 1398 | * @return \Pyz\Zed\DataImport\Business\Model\Product\AttributesExtractorStep |
||
| 1399 | */ |
||
| 1400 | public function createCombinedAttributesExtractorStep(): DataImportStepInterface |
||
| 1401 | { |
||
| 1402 | return new CombinedAttributesExtractorStep(); |
||
| 1403 | } |
||
| 1404 | |||
| 1405 | /** |
||
| 1406 | * @param array<mixed> $defaultAttributes |
||
| 1407 | */ |
||
| 1408 | public function createCombinedProductLocalizedAttributesExtractorStep( |
||
| 1409 | array $defaultAttributes = [], |
||
| 1410 | ): ProductLocalizedAttributesExtractorStep { |
||
| 1411 | return new CombinedProductLocalizedAttributesExtractorStep($defaultAttributes); |
||
| 1412 | } |
||
| 1413 | } |
||
| 1414 |
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