Skip to content

Commit f778962

Browse files
committed
Merge remote-tracking branch 'perf/application-server-part3' into as-store-url
2 parents d3eec3e + de0c5be commit f778962

File tree

57 files changed

+779
-407
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+779
-407
lines changed

app/code/Magento/Backend/Model/Auth/Session.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ public function __construct(
114114
);
115115
}
116116

117+
/**
118+
* @inheritDoc
119+
*/
120+
public function _resetState(): void
121+
{
122+
parent::_resetState();
123+
$this->_isFirstAfterLogin = null;
124+
$this->acl = null;
125+
}
126+
117127
/**
118128
* Refresh ACL resources stored in session
119129
*

app/code/Magento/Backend/Model/Session/Quote.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ public function __construct(
139139
}
140140
}
141141

142+
/**
143+
* @inheritDoc
144+
*/
145+
public function _resetState(): void
146+
{
147+
parent::_resetState();
148+
$this->_quote = null;
149+
$this->_store = null;
150+
$this->_order = null;
151+
}
152+
142153
/**
143154
* Retrieve quote model object
144155
*
@@ -154,7 +165,7 @@ public function getQuote()
154165
$this->_quote->setCustomerGroupId($customerGroupId);
155166
$this->_quote->setIsActive(false);
156167
$this->_quote->setStoreId($this->getStoreId());
157-
168+
158169
$this->quoteRepository->save($this->_quote);
159170
$this->setQuoteId($this->_quote->getId());
160171
$this->_quote = $this->quoteRepository->get($this->getQuoteId(), [$this->getStoreId()]);

app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ public function __construct(
128128
$metadataPool,
129129
$tableMaintainer
130130
);
131-
132131
$this->stockItem = $stockItem
133132
?? ObjectManager::getInstance()->get(\Magento\CatalogInventory\Model\ResourceModel\Stock\Item::class);
134133
}
@@ -145,6 +144,17 @@ protected function _construct()
145144
$this->_selectionTable = $this->getTable('catalog_product_bundle_selection');
146145
}
147146

147+
/**
148+
* @inheritDoc
149+
*/
150+
public function _resetState(): void
151+
{
152+
parent::_resetState();
153+
$this->itemPrototype = null;
154+
$this->catalogRuleProcessor = null;
155+
$this->websiteScopePriceJoined = false;
156+
}
157+
148158
/**
149159
* Set store id for each collection item when collection was loaded.
150160
* phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod
@@ -355,8 +365,6 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false)
355365
* Get Catalog Rule Processor.
356366
*
357367
* @return \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor
358-
*
359-
* @deprecated 100.2.0
360368
*/
361369
private function getCatalogRuleProcessor()
362370
{

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ protected function _construct()
137137
$this->_init(Category::class, \Magento\Catalog\Model\ResourceModel\Category::class);
138138
}
139139

140+
/**
141+
* @inheritDoc
142+
*/
143+
public function _resetState(): void
144+
{
145+
parent::_resetState();
146+
$this->_productTable = null;
147+
$this->_productStoreId = null;
148+
$this->_productWebsiteTable = null;
149+
$this->_loadWithProductCount = false;
150+
}
151+
140152
/**
141153
* Add Id filter
142154
*

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ public function __construct(
7676
);
7777
}
7878

79+
/**
80+
* @inheritDoc
81+
*/
82+
public function _resetState(): void
83+
{
84+
parent::_resetState();
85+
$this->_storeId = null;
86+
}
87+
7988
/**
8089
* Retrieve Entity Primary Key
8190
*

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

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac
102102
*/
103103
protected $_productLimitationFilters;
104104

105+
/**
106+
* @var ProductLimitationFactory
107+
*/
108+
private $productLimitationFactory;
109+
105110
/**
106111
* Category product count select
107112
*
@@ -354,10 +359,10 @@ public function __construct(
354359
$this->_resourceHelper = $resourceHelper;
355360
$this->dateTime = $dateTime;
356361
$this->_groupManagement = $groupManagement;
357-
$productLimitationFactory = $productLimitationFactory ?: ObjectManager::getInstance()->get(
362+
$this->productLimitationFactory = $productLimitationFactory ?: ObjectManager::getInstance()->get(
358363
\Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitationFactory::class
359364
);
360-
$this->_productLimitationFilters = $productLimitationFactory->create();
365+
$this->_productLimitationFilters = $this->productLimitationFactory->create();
361366
$this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(MetadataPool::class);
362367
parent::__construct(
363368
$entityFactory,
@@ -387,6 +392,36 @@ public function __construct(
387392
->get(Gallery::class);
388393
}
389394

395+
/**
396+
* @inheritDoc
397+
*/
398+
public function _resetState(): void
399+
{
400+
parent::_resetState();
401+
$this->_flatEnabled = [];
402+
$this->_addUrlRewrite = false;
403+
$this->_urlRewriteCategory = '';
404+
$this->_addFinalPrice = false;
405+
$this->_allIdsCache = null;
406+
$this->_addTaxPercents = false;
407+
$this->_productLimitationFilters = $this->productLimitationFactory->create();
408+
$this->_productCountSelect = null;
409+
$this->_isWebsiteFilter = false;
410+
$this->_priceDataFieldFilters = [];
411+
$this->_priceExpression = null;
412+
$this->_additionalPriceExpression = null;
413+
$this->_maxPrice = null;
414+
$this->_minPrice = null;
415+
$this->_priceStandardDeviation = null;
416+
$this->_pricesCount = null;
417+
$this->_catalogPreparePriceSelect = null;
418+
$this->needToAddWebsiteNamesToResult = null;
419+
$this->linkField = null;
420+
$this->backend = null;
421+
$this->emptyItem = null;
422+
$this->_construct();
423+
}
424+
390425
/**
391426
* Get cloned Select after dispatching 'catalog_prepare_price_select' event
392427
*

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,11 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
4646
protected $_comparableAttributes;
4747

4848
/**
49-
* Catalog product compare
50-
*
5149
* @var \Magento\Catalog\Helper\Product\Compare
5250
*/
5351
protected $_catalogProductCompare = null;
5452

5553
/**
56-
* Catalog product compare item
57-
*
5854
* @var \Magento\Catalog\Model\ResourceModel\Product\Compare\Item
5955
*/
6056
protected $_catalogProductCompareItem;
@@ -150,6 +146,18 @@ protected function _construct()
150146
$this->_initTables();
151147
}
152148

149+
/**
150+
* @inheritDoc
151+
*/
152+
public function _resetState(): void
153+
{
154+
parent::_resetState();
155+
$this->_customerId = 0;
156+
$this->_visitorId = 0;
157+
$this->listId = 0;
158+
$this->_comparableAttributes = null;
159+
}
160+
153161
/**
154162
* Set customer filter to collection
155163
*
@@ -287,7 +295,6 @@ public function getProductsByListId(int $listId): array
287295
return $this->getConnection()->fetchCol($select);
288296
}
289297

290-
291298
/**
292299
* Set list_id for customer compare item
293300
*

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,21 @@ public function __construct(
183183
}
184184
}
185185

186+
/**
187+
* @inheritDoc
188+
*/
189+
public function _resetState(): void
190+
{
191+
parent::_resetState();
192+
$this->_product = null;
193+
$this->_linkModel = null;
194+
$this->_linkTypeId = null;
195+
$this->_isStrongMode = null;
196+
$this->_hasLinkFilter = false;
197+
$this->productIds = null;
198+
$this->linkField = null;
199+
}
200+
186201
/**
187202
* Declare link model and initialize type attributes join
188203
*

app/code/Magento/CatalogGraphQl/Model/Config/SortAttributeReader.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
namespace Magento\CatalogGraphQl\Model\Config;
88

9+
use Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection as AttributesCollection;
10+
use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory as AttributesCollectionFactory;
11+
use Magento\Framework\App\ObjectManager;
912
use Magento\Framework\Config\ReaderInterface;
1013
use Magento\Framework\GraphQl\Schema\Type\Entity\MapperInterface;
11-
use Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection as AttributesCollection;
1214

1315
/**
1416
* Adds custom/eav attribute to catalog products sorting in the GraphQL config.
@@ -31,20 +33,24 @@ class SortAttributeReader implements ReaderInterface
3133
private $mapper;
3234

3335
/**
34-
* @var AttributesCollection
36+
* @var AttributesCollectionFactory
3537
*/
36-
private $attributesCollection;
38+
private $attributesCollectionFactory;
3739

3840
/**
3941
* @param MapperInterface $mapper
40-
* @param AttributesCollection $attributesCollection
42+
* @param AttributesCollection $attributesCollection @deprecated @see $attributesCollectionFactory
43+
* @param AttributesCollectionFactory|null $attributesCollectionFactory
44+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4145
*/
4246
public function __construct(
4347
MapperInterface $mapper,
44-
AttributesCollection $attributesCollection
48+
AttributesCollection $attributesCollection,
49+
?AttributesCollectionFactory $attributesCollectionFactory = null
4550
) {
4651
$this->mapper = $mapper;
47-
$this->attributesCollection = $attributesCollection;
52+
$this->attributesCollectionFactory = $attributesCollectionFactory
53+
?? ObjectManager::getInstance()->get(AttributesCollectionFactory::class);
4854
}
4955

5056
/**
@@ -58,7 +64,8 @@ public function read($scope = null) : array
5864
{
5965
$map = $this->mapper->getMappedTypes(self::ENTITY_TYPE);
6066
$config =[];
61-
$attributes = $this->attributesCollection->addSearchableAttributeFilter()->addFilter('used_for_sort_by', 1);
67+
$attributes = $this->attributesCollectionFactory->create()
68+
->addSearchableAttributeFilter()->addFilter('used_for_sort_by', 1);
6269
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */
6370
foreach ($attributes as $attribute) {
6471
$attributeCode = $attribute->getAttributeCode();
@@ -73,7 +80,6 @@ public function read($scope = null) : array
7380
];
7481
}
7582
}
76-
7783
return $config;
7884
}
7985
}

app/code/Magento/CatalogInventory/Helper/Minsaleqty.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88

99
use Magento\Customer\Api\GroupManagementInterface;
1010
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1112
use Magento\Framework\Serialize\Serializer\Json;
1213
use Magento\Store\Model\Store;
1314

1415
/**
1516
* MinSaleQty value manipulation helper
1617
*/
17-
class Minsaleqty
18+
class Minsaleqty implements ResetAfterRequestInterface
1819
{
1920
/**
2021
* Core store config
@@ -61,6 +62,14 @@ public function __construct(
6162
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
6263
}
6364

65+
/**
66+
* @inheritDoc
67+
*/
68+
public function _resetState(): void
69+
{
70+
$this->minSaleQtyCache = [];
71+
}
72+
6473
/**
6574
* Retrieve fixed qty value
6675
*

0 commit comments

Comments
 (0)