6
6
7
7
namespace Magento \CatalogUrlRewrite \Observer ;
8
8
9
- use Magento \Catalog \Api \Data \ProductInterface ;
10
9
use Magento \Catalog \Model \Category ;
11
10
use Magento \Catalog \Model \Product ;
12
11
use Magento \Catalog \Model \Product \Visibility ;
@@ -51,25 +50,25 @@ class AfterImportDataObserver implements ObserverInterface
51
50
52
51
/**
53
52
* @var StoreViewService
54
- * @deprecated
53
+ * @deprecated No longer used.
55
54
*/
56
55
protected $ storeViewService ;
57
56
58
57
/**
59
58
* @var Product
60
- * @deprecated
59
+ * @deprecated No longer used.
61
60
*/
62
61
protected $ product ;
63
62
64
63
/**
65
64
* @var array
66
- * @deprecated
65
+ * @deprecated No longer used.
67
66
*/
68
67
protected $ productsWithStores ;
69
68
70
69
/**
71
70
* @var array
72
- * @deprecated
71
+ * @deprecated No longer used.
73
72
*/
74
73
protected $ products = [];
75
74
@@ -197,6 +196,7 @@ class AfterImportDataObserver implements ObserverInterface
197
196
* @param ScopeConfigInterface|null $scopeConfig
198
197
* @param CollectionFactory|null $collectionFactory
199
198
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
199
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
200
200
*/
201
201
public function __construct (
202
202
ProductFactory $ catalogProductFactory ,
@@ -275,7 +275,7 @@ private function populateForUrlsGeneration(array $bunch) : array
275
275
}
276
276
}
277
277
}
278
- foreach ($ productIdsMissingUrlKeyByStore as $ storeId => $ productIds ) {
278
+ foreach ($ productIdsMissingUrlKeyByStore as $ storeId => $ productIds ) {
279
279
$ this ->getUrlKeyAndNameForProductsByIds ($ productIds , $ storeId , $ products );
280
280
}
281
281
return $ products ;
@@ -286,7 +286,7 @@ private function populateForUrlsGeneration(array $bunch) : array
286
286
*
287
287
* @param array $rowData
288
288
* @param Product[] &$products
289
- * @return AfterImportDataObserver|null
289
+ * @return void
290
290
* @throws LocalizedException
291
291
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
292
292
*/
@@ -450,7 +450,6 @@ private function canonicalUrlRewriteGenerate(array $products)
450
450
}
451
451
}
452
452
}
453
-
454
453
return $ urls ;
455
454
}
456
455
@@ -579,18 +578,17 @@ private function generateForCustom(UrlRewrite $url, ?Category $category, array $
579
578
if ($ url ->getRequestPath () === $ targetPath ) {
580
579
return [];
581
580
}
582
- return [
583
- $ this ->urlRewriteFactory ->create ()
584
- ->setEntityType (ProductUrlRewriteGenerator::ENTITY_TYPE )
585
- ->setEntityId ($ productId )
586
- ->setRequestPath ($ url ->getRequestPath ())
587
- ->setTargetPath ($ targetPath )
588
- ->setRedirectType ($ url ->getRedirectType ())
589
- ->setStoreId ($ storeId )
590
- ->setDescription ($ url ->getDescription ())
591
- ->setIsAutogenerated (0 )
592
- ->setMetadata ($ url ->getMetadata ())
593
- ];
581
+ $ urlRewrite = $ this ->urlRewriteFactory ->create ();
582
+ $ urlRewrite ->setEntityType (ProductUrlRewriteGenerator::ENTITY_TYPE );
583
+ $ urlRewrite ->setEntityId ($ productId );
584
+ $ urlRewrite ->setRequestPath ($ url ->getRequestPath ());
585
+ $ urlRewrite ->setTargetPath ($ targetPath );
586
+ $ urlRewrite ->setRedirectType ($ url ->getRedirectType ());
587
+ $ urlRewrite ->setStoreId ($ storeId );
588
+ $ urlRewrite ->setDescription ($ url ->getDescription ());
589
+ $ urlRewrite ->setIsAutogenerated (0 );
590
+ $ urlRewrite ->setMetadata ($ url ->getMetadata ());
591
+ return [$ urlRewrite ];
594
592
}
595
593
return [];
596
594
}
@@ -681,7 +679,7 @@ private function getParentCategoriesUrlRewrites(array $categoryIds, int $storeId
681
679
*
682
680
* @param int[] $productIds
683
681
* @param int $storeId
684
- * @param array[] $products
682
+ * @param array[] $importedProducts
685
683
* @return void
686
684
*/
687
685
private function getUrlKeyAndNameForProductsByIds (array $ productIds , int $ storeId , array $ importedProducts ): void
0 commit comments