@@ -330,7 +330,6 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac
330
330
* @param TableMaintainer|null $tableMaintainer
331
331
* @param PriceTableResolver|null $priceTableResolver
332
332
* @param DimensionFactory|null $dimensionFactory
333
- * @param DbStorage|null $urlFinder
334
333
*
335
334
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
336
335
*/
@@ -359,8 +358,7 @@ public function __construct(
359
358
MetadataPool $ metadataPool = null ,
360
359
TableMaintainer $ tableMaintainer = null ,
361
360
PriceTableResolver $ priceTableResolver = null ,
362
- DimensionFactory $ dimensionFactory = null ,
363
- DbStorage $ urlFinder = null
361
+ DimensionFactory $ dimensionFactory = null
364
362
) {
365
363
$ this ->moduleManager = $ moduleManager ;
366
364
$ this ->_catalogProductFlatState = $ catalogProductFlatState ;
@@ -394,7 +392,19 @@ public function __construct(
394
392
$ this ->priceTableResolver = $ priceTableResolver ?: ObjectManager::getInstance ()->get (PriceTableResolver::class);
395
393
$ this ->dimensionFactory = $ dimensionFactory
396
394
?: ObjectManager::getInstance ()->get (DimensionFactory::class);
397
- $ this ->urlFinder = $ urlFinder ?: ObjectManager::getInstance ()->get (DbStorage::class);
395
+ }
396
+
397
+ /**
398
+ * Retrieve urlFinder
399
+ *
400
+ * @return GalleryReadHandler
401
+ */
402
+ private function getUrlFinder ()
403
+ {
404
+ if ($ this ->urlFinder === null ) {
405
+ $ this ->urlFinder = ObjectManager::getInstance ()->get (DbStorage::class);
406
+ }
407
+ return $ this ->urlFinder ;
398
408
}
399
409
400
410
/**
@@ -1437,7 +1447,7 @@ protected function _addUrlRewrite()
1437
1447
$ filter ['metadata ' ]['category_id ' ] = $ this ->_urlRewriteCategory ;
1438
1448
}
1439
1449
1440
- $ rewrites = $ this ->urlFinder ->findAllByData ($ filter );
1450
+ $ rewrites = $ this ->getUrlFinder () ->findAllByData ($ filter );
1441
1451
foreach ($ rewrites as $ rewrite ) {
1442
1452
if ($ item = $ this ->getItemById ($ rewrite ->getEntityId ())) {
1443
1453
$ item ->setData ('request_path ' , $ rewrite ->getRequestPath ());
0 commit comments