@@ -216,6 +216,7 @@ class Category extends \Magento\ImportExport\Model\Import\AbstractEntity
216216 private CategoryUrlRewriteGenerator $ categoryUrlRewriteGenerator ;
217217 private UrlPersistInterface $ urlPersist ;
218218 private CategoryRepositoryInterface $ categoryRepository ;
219+ private Config $ config ;
219220
220221 public function __construct (
221222 StringUtils $ string ,
@@ -239,6 +240,7 @@ public function __construct(
239240 CategoryUrlRewriteGenerator $ categoryUrlRewriteGenerator ,
240241 CategoryRepositoryInterface $ categoryRepository ,
241242 UrlPersistInterface $ urlPersist ,
243+ Config $ config ,
242244 array $ data = []
243245 ) {
244246 parent ::__construct (
@@ -279,8 +281,9 @@ public function __construct(
279281 ->initAttributes ()
280282 ->initAttributeSetId ();
281283
282- $ this ->entityTable = $ this ->defaultCategory ->getResource ()->getEntityTable ();
284+ $ this ->entityTable = $ this ->defaultCategory ->getResource ()->getEntityTable ();
283285 $ this ->categoryImportVersionFeature = $ this ->versionFeatures ->create ('CategoryImportVersion ' );
286+ $ this ->config = $ config ;
284287 }
285288
286289 /**
@@ -382,10 +385,7 @@ private function initCategories(): self
382385 $ this ->categoriesWithRoots [$ rootCategoryName ] = [];
383386 }
384387
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 );
389389 $ this ->categoriesWithRoots [$ rootCategoryName ][$ index ] = [
390390 'entity_id ' => $ category ->getId (),
391391 CategoryInterface::KEY_PATH => $ category ->getData (CategoryInterface::KEY_PATH ),
@@ -417,10 +417,7 @@ private function implodeEscaped(string $glue, array $array): string
417417 foreach ($ array as $ value ) {
418418 $ newArray [] = str_replace ($ glue , '\\' . $ glue , $ value );
419419 }
420- return implode (
421- $ this ->_scopeConfig ->getValue (Config::XML_PATH_CATEGORY_PATH_SEPERATOR ),
422- $ newArray
423- );
420+ return implode ($ this ->config ->getCategoryPathSeparator (), $ newArray );
424421 }
425422
426423 /**
@@ -861,10 +858,7 @@ private function getCategoryName(array $rowData): string
861858 return $ rowData [CategoryModel::KEY_NAME ];
862859 }
863860
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 ]);
868862 return end ($ categoryParts );
869863 }
870864
@@ -911,15 +905,10 @@ protected function getParentCategory(array $rowData)
911905 );
912906 $ parent = $ categoryParts [count ($ categoryParts ) - 2 ];
913907 } 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 ]);
918910 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 );
923912 }
924913
925914 if ($ parent ) {
0 commit comments