@@ -216,6 +216,7 @@ class Category extends \Magento\ImportExport\Model\Import\AbstractEntity
216
216
private CategoryUrlRewriteGenerator $ categoryUrlRewriteGenerator ;
217
217
private UrlPersistInterface $ urlPersist ;
218
218
private CategoryRepositoryInterface $ categoryRepository ;
219
+ private Config $ config ;
219
220
220
221
public function __construct (
221
222
StringUtils $ string ,
@@ -239,6 +240,7 @@ public function __construct(
239
240
CategoryUrlRewriteGenerator $ categoryUrlRewriteGenerator ,
240
241
CategoryRepositoryInterface $ categoryRepository ,
241
242
UrlPersistInterface $ urlPersist ,
243
+ Config $ config ,
242
244
array $ data = []
243
245
) {
244
246
parent ::__construct (
@@ -279,8 +281,9 @@ public function __construct(
279
281
->initAttributes ()
280
282
->initAttributeSetId ();
281
283
282
- $ this ->entityTable = $ this ->defaultCategory ->getResource ()->getEntityTable ();
284
+ $ this ->entityTable = $ this ->defaultCategory ->getResource ()->getEntityTable ();
283
285
$ this ->categoryImportVersionFeature = $ this ->versionFeatures ->create ('CategoryImportVersion ' );
286
+ $ this ->config = $ config ;
284
287
}
285
288
286
289
/**
@@ -382,10 +385,7 @@ private function initCategories(): self
382
385
$ this ->categoriesWithRoots [$ rootCategoryName ] = [];
383
386
}
384
387
385
- $ index = $ this ->implodeEscaped (
386
- (string ) $ this ->_scopeConfig ->getValue (Config::XML_PATH_CATEGORY_PATH_SEPERATOR ),
387
- $ path
388
- );
388
+ $ index = $ this ->implodeEscaped ($ this ->config ->getCategoryPathSeparator (), $ path );
389
389
$ this ->categoriesWithRoots [$ rootCategoryName ][$ index ] = [
390
390
'entity_id ' => $ category ->getId (),
391
391
CategoryInterface::KEY_PATH => $ category ->getData (CategoryInterface::KEY_PATH ),
@@ -417,10 +417,7 @@ private function implodeEscaped(string $glue, array $array): string
417
417
foreach ($ array as $ value ) {
418
418
$ newArray [] = str_replace ($ glue , '\\' . $ glue , $ value );
419
419
}
420
- return implode (
421
- $ this ->_scopeConfig ->getValue (Config::XML_PATH_CATEGORY_PATH_SEPERATOR ),
422
- $ newArray
423
- );
420
+ return implode ($ this ->config ->getCategoryPathSeparator (), $ newArray );
424
421
}
425
422
426
423
/**
@@ -861,10 +858,7 @@ private function getCategoryName(array $rowData): string
861
858
return $ rowData [CategoryModel::KEY_NAME ];
862
859
}
863
860
864
- $ categoryParts = $ this ->explodeEscaped (
865
- (string ) $ this ->_scopeConfig ->getValue (Config::XML_PATH_CATEGORY_PATH_SEPERATOR ),
866
- $ rowData [self ::COL_CATEGORY ]
867
- );
861
+ $ categoryParts = $ this ->explodeEscaped ($ this ->config ->getCategoryPathSeparator (), $ rowData [self ::COL_CATEGORY ]);
868
862
return end ($ categoryParts );
869
863
}
870
864
@@ -911,15 +905,10 @@ protected function getParentCategory(array $rowData)
911
905
);
912
906
$ parent = $ categoryParts [count ($ categoryParts ) - 2 ];
913
907
} else {
914
- $ categoryParts = $ this ->explodeEscaped (
915
- (string ) $ this ->_scopeConfig ->getValue (Config::XML_PATH_CATEGORY_PATH_SEPERATOR ),
916
- $ rowData [self ::COL_CATEGORY ]
917
- );
908
+ $ categoryParts = $ this ->explodeEscaped ($ this ->config ->getCategoryPathSeparator (),
909
+ $ rowData [self ::COL_CATEGORY ]);
918
910
array_pop ($ categoryParts );
919
- $ parent = $ this ->implodeEscaped (
920
- (string ) $ this ->_scopeConfig ->getValue (Config::XML_PATH_CATEGORY_PATH_SEPERATOR ),
921
- $ categoryParts
922
- );
911
+ $ parent = $ this ->implodeEscaped ($ this ->config ->getCategoryPathSeparator (), $ categoryParts );
923
912
}
924
913
925
914
if ($ parent ) {
0 commit comments