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