Skip to content

Commit 5569b86

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #21260: Code clean for page doc comment on select.test.js (by @lpj822) - #19359: Removed direct use of SessionManager class, used SessionManagerInterface instead (by @jaimin-ktpl) - #13302: Introduce resource model pool to replace UniversalFactory (by @schmengler) Fixed GitHub Issues: - #19274: Why is SessionManager used instead of its Interface? (reported by @dyuk1987) has been fixed in #19359 by @jaimin-ktpl in 2.3-develop branch Related commits: 1. 8b30520 2. 05dadd8
2 parents 4fb0f1a + 3e35044 commit 5569b86

File tree

34 files changed

+605
-378
lines changed

34 files changed

+605
-378
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator;
99
use Magento\Framework\App\Config\ScopeConfigInterface;
10+
use Magento\Framework\Model\ResourceModel\ResourceModelPoolInterface;
1011
use Magento\Store\Model\ScopeInterface;
1112

1213
/**
@@ -83,6 +84,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac
8384
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
8485
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
8586
*
87+
* @param ResourceModelPoolInterface|null $resourceModelPool
8688
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8789
*/
8890
public function __construct(
@@ -97,7 +99,8 @@ public function __construct(
9799
\Magento\Framework\Validator\UniversalFactory $universalFactory,
98100
\Magento\Store\Model\StoreManagerInterface $storeManager,
99101
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
100-
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig = null
102+
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig = null,
103+
ResourceModelPoolInterface $resourceModelPool = null
101104
) {
102105
parent::__construct(
103106
$entityFactory,
@@ -110,7 +113,8 @@ public function __construct(
110113
$resourceHelper,
111114
$universalFactory,
112115
$storeManager,
113-
$connection
116+
$connection,
117+
$resourceModelPool
114118
);
115119
$this->scopeConfig = $scopeConfig ?:
116120
\Magento\Framework\App\ObjectManager::getInstance()->get(ScopeConfigInterface::class);

app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
*/
66
namespace Magento\Catalog\Model\ResourceModel\Collection;
77

8+
use Magento\Framework\Model\ResourceModel\ResourceModelPoolInterface;
9+
810
/**
911
* Catalog EAV collection resource abstract model
12+
*
1013
* Implement using different stores for retrieve attribute values
1114
*
1215
* @api
@@ -43,6 +46,7 @@ class AbstractCollection extends \Magento\Eav\Model\Entity\Collection\AbstractCo
4346
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
4447
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
4548
*
49+
* @param ResourceModelPoolInterface|null $resourceModelPool
4650
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
4751
*/
4852
public function __construct(
@@ -56,7 +60,8 @@ public function __construct(
5660
\Magento\Eav\Model\ResourceModel\Helper $resourceHelper,
5761
\Magento\Framework\Validator\UniversalFactory $universalFactory,
5862
\Magento\Store\Model\StoreManagerInterface $storeManager,
59-
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null
63+
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
64+
ResourceModelPoolInterface $resourceModelPool = null
6065
) {
6166
$this->_storeManager = $storeManager;
6267
parent::__construct(
@@ -69,7 +74,8 @@ public function __construct(
6974
$eavEntityFactory,
7075
$resourceHelper,
7176
$universalFactory,
72-
$connection
77+
$connection,
78+
$resourceModelPool
7379
);
7480
}
7581

@@ -205,10 +211,7 @@ protected function _getLoadAttributesSelect($table, $attributeIds = [])
205211
}
206212

207213
/**
208-
* @param \Magento\Framework\DB\Select $select
209-
* @param string $table
210-
* @param string $type
211-
* @return \Magento\Framework\DB\Select
214+
* @inheritdoc
212215
*/
213216
protected function _addLoadAttributesSelectValues($select, $table, $type)
214217
{

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Magento\Store\Model\Store;
2222
use Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer;
2323
use Magento\Framework\Indexer\DimensionFactory;
24+
use Magento\Framework\Model\ResourceModel\ResourceModelPoolInterface;
2425

2526
/**
2627
* Product collection
@@ -297,6 +298,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac
297298

298299
/**
299300
* Collection constructor
301+
*
300302
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
301303
* @param \Psr\Log\LoggerInterface $logger
302304
* @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
@@ -322,6 +324,8 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac
322324
* @param TableMaintainer|null $tableMaintainer
323325
* @param PriceTableResolver|null $priceTableResolver
324326
* @param DimensionFactory|null $dimensionFactory
327+
* @param ResourceModelPoolInterface|null $resourceModelPool
328+
*
325329
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
326330
*/
327331
public function __construct(
@@ -349,7 +353,8 @@ public function __construct(
349353
MetadataPool $metadataPool = null,
350354
TableMaintainer $tableMaintainer = null,
351355
PriceTableResolver $priceTableResolver = null,
352-
DimensionFactory $dimensionFactory = null
356+
DimensionFactory $dimensionFactory = null,
357+
ResourceModelPoolInterface $resourceModelPool = null
353358
) {
354359
$this->moduleManager = $moduleManager;
355360
$this->_catalogProductFlatState = $catalogProductFlatState;
@@ -377,7 +382,8 @@ public function __construct(
377382
$resourceHelper,
378383
$universalFactory,
379384
$storeManager,
380-
$connection
385+
$connection,
386+
$resourceModelPool
381387
);
382388
$this->tableMaintainer = $tableMaintainer ?: ObjectManager::getInstance()->get(TableMaintainer::class);
383389
$this->priceTableResolver = $priceTableResolver ?: ObjectManager::getInstance()->get(PriceTableResolver::class);
@@ -1437,7 +1443,7 @@ protected function _addUrlRewrite()
14371443
'u.url_rewrite_id=cu.url_rewrite_id'
14381444
)->where('cu.url_rewrite_id IS NULL');
14391445
}
1440-
1446+
14411447
// more priority is data with category id
14421448
$urlRewrites = [];
14431449

app/code/Magento/Catalog/Model/ResourceModel/Product/Compare/Item/Collection.php

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
*/
66
namespace Magento\Catalog\Model\ResourceModel\Product\Compare\Item;
77

8+
use Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer;
9+
use Magento\Catalog\Model\Indexer\Product\Price\PriceTableResolver;
10+
use Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitationFactory;
11+
use Magento\Framework\EntityManager\MetadataPool;
12+
use Magento\Framework\Indexer\DimensionFactory;
13+
use Magento\Framework\Model\ResourceModel\ResourceModelPoolInterface;
14+
815
/**
916
* Catalog Product Compare Items Resource Collection
1017
*
@@ -75,7 +82,12 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
7582
* @param \Magento\Catalog\Model\ResourceModel\Product\Compare\Item $catalogProductCompareItem
7683
* @param \Magento\Catalog\Helper\Product\Compare $catalogProductCompare
7784
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
78-
*
85+
* @param ProductLimitationFactory|null $productLimitationFactory
86+
* @param MetadataPool|null $metadataPool
87+
* @param TableMaintainer|null $tableMaintainer
88+
* @param PriceTableResolver|null $priceTableResolver
89+
* @param DimensionFactory|null $dimensionFactory
90+
* @param ResourceModelPoolInterface|null $resourceModelPool
7991
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8092
*/
8193
public function __construct(
@@ -100,7 +112,13 @@ public function __construct(
100112
\Magento\Customer\Api\GroupManagementInterface $groupManagement,
101113
\Magento\Catalog\Model\ResourceModel\Product\Compare\Item $catalogProductCompareItem,
102114
\Magento\Catalog\Helper\Product\Compare $catalogProductCompare,
103-
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null
115+
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
116+
ProductLimitationFactory $productLimitationFactory = null,
117+
MetadataPool $metadataPool = null,
118+
TableMaintainer $tableMaintainer = null,
119+
PriceTableResolver $priceTableResolver = null,
120+
DimensionFactory $dimensionFactory = null,
121+
ResourceModelPoolInterface $resourceModelPool = null
104122
) {
105123
$this->_catalogProductCompareItem = $catalogProductCompareItem;
106124
$this->_catalogProductCompare = $catalogProductCompare;
@@ -124,7 +142,13 @@ public function __construct(
124142
$customerSession,
125143
$dateTime,
126144
$groupManagement,
127-
$connection
145+
$connection,
146+
$productLimitationFactory,
147+
$metadataPool,
148+
$tableMaintainer,
149+
$priceTableResolver,
150+
$dimensionFactory,
151+
$resourceModelPool
128152
);
129153
}
130154

@@ -403,6 +427,7 @@ public function clear()
403427

404428
/**
405429
* Retrieve is flat enabled flag
430+
*
406431
* Overwrite disable flat for compared item if required EAV resource
407432
*
408433
* @return bool

0 commit comments

Comments
 (0)