@@ -30,18 +30,21 @@ class CurrentUrlRewritesRegenerator
3030 /**
3131 * @var Product
3232 * @deprecated 100.1.0
33+ * @see not used
3334 */
3435 protected $ product ;
3536
3637 /**
3738 * @var ObjectRegistry
3839 * @deprecated 100.1.0
40+ * @see not used
3941 */
4042 protected $ productCategories ;
4143
4244 /**
4345 * @var UrlFinderInterface
4446 * @deprecated 100.1.0
47+ * @see not used
4548 */
4649 protected $ urlFinder ;
4750
@@ -87,6 +90,7 @@ class CurrentUrlRewritesRegenerator
8790 * @param UrlRewriteFinder|null $urlRewriteFinder
8891 * @param \Magento\UrlRewrite\Model\MergeDataProviderFactory|null $mergeDataProviderFactory
8992 * @param CategoryRepository|null $categoryRepository
93+ * @param ScopeConfigInterface|null $scopeConfig
9094 */
9195 public function __construct (
9296 UrlFinderInterface $ urlFinder ,
@@ -176,10 +180,11 @@ public function generateAnchor(
176180 ProductUrlRewriteGenerator::ENTITY_TYPE ,
177181 $ rootCategoryId
178182 );
179-
180- foreach ($ productCategories ->getList () as $ productCategory ) {
181- $ anchorCategoryIds = array_merge ($ productCategory ->getAnchorsAbove (), $ anchorCategoryIds );
182- }
183+ $ anchorCategoryIds = array_merge (
184+ ...array_map (
185+ fn ($ productCategory ) => $ productCategory ->getAnchorsAbove (), $ productCategories ->getList ()
186+ )
187+ );
183188
184189 foreach ($ currentUrlRewrites as $ currentUrlRewrite ) {
185190 $ metadata = $ currentUrlRewrite ->getMetadata ();
@@ -199,6 +204,8 @@ public function generateAnchor(
199204 }
200205
201206 /**
207+ * Generate URL rewrites for autogenerated URLs
208+ *
202209 * @param UrlRewrite $url
203210 * @param int $storeId
204211 * @param Category|null $category
@@ -227,6 +234,8 @@ protected function generateForAutogenerated($url, $storeId, $category, $product
227234 }
228235
229236 /**
237+ * Generate URL rewrites for custom URLs
238+ *
230239 * @param UrlRewrite $url
231240 * @param int $storeId
232241 * @param Category|null $category
@@ -255,6 +264,8 @@ protected function generateForCustom($url, $storeId, $category, $product = null)
255264 }
256265
257266 /**
267+ * Retrieve category from URL metadata
268+ *
258269 * @param UrlRewrite $url
259270 * @param ObjectRegistry|null $productCategories
260271 * @return Category|null|bool
0 commit comments