Skip to content

Commit 6a5917e

Browse files
committed
Merge remote-tracking branch 'upstream/2.4-develop' into cron-log
2 parents 752821b + 98fb0dc commit 6a5917e

File tree

135 files changed

+2327
-379
lines changed

Some content is hidden

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

135 files changed

+2327
-379
lines changed

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Magento\Framework\DataObject;
2020
use Magento\Framework\Json\EncoderInterface;
2121
use Magento\Framework\Locale\FormatInterface;
22+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
2223
use Magento\Framework\Stdlib\ArrayUtils;
2324

2425
/**
@@ -28,7 +29,7 @@
2829
* @since 100.0.2
2930
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3031
*/
31-
class Bundle extends AbstractView
32+
class Bundle extends AbstractView implements ResetAfterRequestInterface
3233
{
3334
/**
3435
* @var array
@@ -421,4 +422,13 @@ function (&$selection, $selectionId) use ($preConfiguredQtys) {
421422

422423
return $options;
423424
}
425+
426+
/**
427+
* @inheritDoc
428+
*/
429+
public function _resetState(): void
430+
{
431+
$this->selectedOptions = [];
432+
$this->optionsPosition = [];
433+
}
424434
}

app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price/DisabledProductOptionPriceModifier.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
use Magento\Framework\EntityManager\MetadataPool;
1616
use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\PriceModifierInterface;
1717
use Magento\Bundle\Model\ResourceModel\Selection as BundleSelection;
18+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1819

1920
/**
2021
* Remove bundle product from price index when all products in required option are disabled
2122
*/
22-
class DisabledProductOptionPriceModifier implements PriceModifierInterface
23+
class DisabledProductOptionPriceModifier implements PriceModifierInterface, ResetAfterRequestInterface
2324
{
2425
/**
2526
* @var ResourceConnection
@@ -145,4 +146,12 @@ private function getBundleIds(array $entityIds): \Traversable
145146
yield $id;
146147
}
147148
}
149+
150+
/**
151+
* @inheritDoc
152+
*/
153+
public function _resetState(): void
154+
{
155+
$this->websiteIdsOfProduct = [];
156+
}
148157
}

app/code/Magento/BundleGraphQl/Model/Resolver/Options/Collection.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
1212
use Magento\Framework\App\ObjectManager;
1313
use Magento\Framework\GraphQl\Query\Uid;
14+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1415
use Magento\Store\Model\StoreManagerInterface;
1516

1617
/**
1718
* Collection to fetch bundle option data at resolution time.
1819
*/
19-
class Collection
20+
class Collection implements ResetAfterRequestInterface
2021
{
2122
/**
2223
* Option type name
@@ -145,4 +146,13 @@ private function fetch() : array
145146

146147
return $this->optionMap;
147148
}
149+
150+
/**
151+
* @inheritDoc
152+
*/
153+
public function _resetState(): void
154+
{
155+
$this->optionMap = [];
156+
$this->skuMap = [];
157+
}
148158
}

app/code/Magento/Catalog/Model/CategoryRepository.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Catalog\Model;
99

10+
use Magento\Catalog\Api\CategoryRepositoryInterface;
1011
use Magento\Catalog\Model\CategoryRepository\PopulateWithValues;
1112
use Magento\Catalog\Model\ResourceModel\Category as CategoryResource;
1213
use Magento\Framework\Api\ExtensibleDataObjectConverter;
@@ -16,14 +17,15 @@
1617
use Magento\Framework\Exception\NoSuchEntityException;
1718
use Magento\Framework\Exception\StateException;
1819
use Magento\Catalog\Api\Data\CategoryInterface;
20+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1921
use Magento\Store\Model\StoreManagerInterface;
2022

2123
/**
2224
* Repository for categories.
2325
*
2426
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2527
*/
26-
class CategoryRepository implements \Magento\Catalog\Api\CategoryRepositoryInterface
28+
class CategoryRepository implements CategoryRepositoryInterface, ResetAfterRequestInterface
2729
{
2830
/**
2931
* @var Category[]
@@ -231,6 +233,7 @@ protected function validateCategory(Category $category)
231233
* @return ExtensibleDataObjectConverter
232234
*
233235
* @deprecated 101.0.0
236+
* @see we don't recommend this approach anymore
234237
*/
235238
private function getExtensibleDataObjectConverter()
236239
{
@@ -254,4 +257,12 @@ private function getMetadataPool()
254257
}
255258
return $this->metadataPool;
256259
}
260+
261+
/**
262+
* @inheritDoc
263+
*/
264+
public function _resetState(): void
265+
{
266+
$this->instances = [];
267+
}
257268
}

app/code/Magento/Catalog/Model/CategoryRepository/PopulateWithValues.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
1616
use Magento\Framework\Api\FilterBuilder;
1717
use Magento\Framework\Api\SearchCriteriaBuilder;
18+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1819
use Magento\Store\Model\Store;
1920

2021
/**
2122
* Add data to category entity and populate with default values
2223
*/
23-
class PopulateWithValues
24+
class PopulateWithValues implements ResetAfterRequestInterface
2425
{
2526
/**
2627
* @var ScopeOverriddenValue
@@ -150,4 +151,12 @@ private function getAttributes(): array
150151

151152
return $this->attributes;
152153
}
154+
155+
/**
156+
* @inheritDoc
157+
*/
158+
public function _resetState(): void
159+
{
160+
$this->attributes = [];
161+
}
153162
}

app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Framework\DB\Query\Generator as QueryGenerator;
1414
use Magento\Framework\DB\Select;
1515
use Magento\Framework\EntityManager\MetadataPool;
16+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1617
use Magento\Store\Api\Data\StoreInterface;
1718
use Magento\Store\Model\Store;
1819

@@ -24,8 +25,9 @@
2425
*
2526
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2627
* @since 100.0.2
28+
* phpcs:disable Magento2.Annotation.MethodAnnotationStructure.InvalidDeprecatedTagUsage
2729
*/
28-
abstract class AbstractAction
30+
abstract class AbstractAction implements ResetAfterRequestInterface
2931
{
3032
/**
3133
* Chunk size
@@ -44,7 +46,8 @@ abstract class AbstractAction
4446

4547
/**
4648
* Suffix for table to show it is temporary
47-
* @deprecated see getIndexTable
49+
* @deprecated
50+
* @see getIndexTable
4851
*/
4952
public const TEMPORARY_TABLE_SUFFIX = '_tmp';
5053

@@ -156,6 +159,20 @@ public function __construct(
156159
$this->tableMaintainer = $tableMaintainer ?: ObjectManager::getInstance()->get(TableMaintainer::class);
157160
}
158161

162+
/**
163+
* @inheritDoc
164+
*/
165+
public function _resetState(): void
166+
{
167+
$this->nonAnchorSelects = [];
168+
$this->anchorSelects = [];
169+
$this->productsSelects = [];
170+
$this->categoryPath = [];
171+
$this->useTempTable = true;
172+
$this->tempTreeIndexTableName = null;
173+
$this->currentStore = null;
174+
}
175+
159176
/**
160177
* Run full reindex
161178
*

app/code/Magento/Catalog/Model/Layer.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\Catalog\Api\CategoryRepositoryInterface;
99
use Magento\Framework\Exception\NoSuchEntityException;
1010
use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory as AttributeCollectionFactory;
11+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1112

1213
/**
1314
* Catalog view layer model
@@ -17,7 +18,7 @@
1718
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1819
* @since 100.0.2
1920
*/
20-
class Layer extends \Magento\Framework\DataObject
21+
class Layer extends \Magento\Framework\DataObject implements ResetAfterRequestInterface
2122
{
2223
/**
2324
* Product collections array
@@ -41,29 +42,21 @@ class Layer extends \Magento\Framework\DataObject
4142
protected $registry = null;
4243

4344
/**
44-
* Store manager
45-
*
4645
* @var \Magento\Store\Model\StoreManagerInterface
4746
*/
4847
protected $_storeManager;
4948

5049
/**
51-
* Catalog product
52-
*
5350
* @var \Magento\Catalog\Model\ResourceModel\Product
5451
*/
5552
protected $_catalogProduct;
5653

5754
/**
58-
* Attribute collection factory
59-
*
6055
* @var AttributeCollectionFactory
6156
*/
6257
protected $_attributeCollectionFactory;
6358

6459
/**
65-
* Layer state factory
66-
*
6760
* @var \Magento\Catalog\Model\Layer\StateFactory
6861
*/
6962
protected $_layerStateFactory;
@@ -187,6 +180,7 @@ public function apply()
187180

188181
/**
189182
* Retrieve current category model
183+
*
190184
* If no category found in registry, the root will be taken
191185
*
192186
* @return \Magento\Catalog\Model\Category
@@ -266,4 +260,12 @@ public function getState()
266260

267261
return $state;
268262
}
263+
264+
/**
265+
* @inheritDoc
266+
*/
267+
public function _resetState(): void
268+
{
269+
$this->_productCollections = [];
270+
}
269271
}

0 commit comments

Comments
 (0)