Skip to content

Commit 1f01980

Browse files
committed
ACPT-1052: Some Luma Storefront Scenarios Are Broken
1 parent 351c720 commit 1f01980

File tree

38 files changed

+410
-39
lines changed

38 files changed

+410
-39
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: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
use Magento\Framework\Exception\NoSuchEntityException;
1717
use Magento\Framework\Exception\StateException;
1818
use Magento\Catalog\Api\Data\CategoryInterface;
19+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1920
use Magento\Store\Model\StoreManagerInterface;
2021

2122
/**
2223
* Repository for categories.
2324
*
2425
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2526
*/
26-
class CategoryRepository implements \Magento\Catalog\Api\CategoryRepositoryInterface
27+
class CategoryRepository implements \Magento\Catalog\Api\CategoryRepositoryInterface,
28+
ResetAfterRequestInterface
2729
{
2830
/**
2931
* @var Category[]
@@ -254,4 +256,12 @@ private function getMetadataPool()
254256
}
255257
return $this->metadataPool;
256258
}
259+
260+
/**
261+
* @inheritDoc
262+
*/
263+
public function _resetState(): void
264+
{
265+
$this->instances = [];
266+
}
257267
}

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/Product.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Magento\Framework\App\Filesystem\DirectoryList;
1717
use Magento\Framework\App\ObjectManager;
1818
use Magento\Framework\DataObject\IdentityInterface;
19+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1920
use Magento\Framework\Pricing\SaleableInterface;
2021

2122
/**
@@ -43,7 +44,8 @@
4344
class Product extends \Magento\Catalog\Model\AbstractModel implements
4445
IdentityInterface,
4546
SaleableInterface,
46-
ProductInterface
47+
ProductInterface,
48+
ResetAfterRequestInterface
4749
{
4850
/**
4951
* @var ProductLinkRepositoryInterface
@@ -2841,4 +2843,15 @@ public function setStockData($stockData)
28412843
$this->setData('stock_data', $stockData);
28422844
return $this;
28432845
}
2846+
2847+
/**
2848+
* @inheritDoc
2849+
*/
2850+
public function _resetState(): void
2851+
{
2852+
$this->_customOptions = [];
2853+
$this->_errors = [];
2854+
$this->_canAffectOptions = [];
2855+
$this->_productIdCached = null;
2856+
}
28442857
}

app/code/Magento/Catalog/Model/Product/Image/Cache.php

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

88
use Magento\Catalog\Helper\Image as ImageHelper;
99
use Magento\Catalog\Model\Product;
10+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1011
use Magento\Theme\Model\ResourceModel\Theme\Collection as ThemeCollection;
1112
use Magento\Framework\App\Area;
1213
use Magento\Framework\View\ConfigInterface;
1314

14-
class Cache
15+
class Cache implements ResetAfterRequestInterface
1516
{
1617
/**
1718
* @var ConfigInterface
@@ -127,4 +128,12 @@ protected function processImageData(Product $product, array $imageData, $file)
127128

128129
return $this;
129130
}
131+
132+
/**
133+
* @inheritDoc
134+
*/
135+
public function _resetState(): void
136+
{
137+
$this->data = [];
138+
}
130139
}

app/code/Magento/Catalog/Model/Product/Media/Config.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Catalog\Model\Product\Media;
88

99
use Magento\Eav\Model\Entity\Attribute;
10+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1011
use Magento\Framework\UrlInterface;
1112
use Magento\Store\Model\StoreManagerInterface;
1213

@@ -16,7 +17,7 @@
1617
* @api
1718
* @since 100.0.2
1819
*/
19-
class Config implements ConfigInterface
20+
class Config implements ConfigInterface, ResetAfterRequestInterface
2021
{
2122
/**
2223
* @var StoreManagerInterface
@@ -199,4 +200,12 @@ private function getAttributeHelper()
199200
}
200201
return $this->attributeHelper;
201202
}
203+
204+
/**
205+
* @inheritDoc
206+
*/
207+
public function _resetState(): void
208+
{
209+
$this->mediaAttributeCodes = [];
210+
}
202211
}

app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface;
1414
use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface;
1515
use Magento\Catalog\Model\Product\Option\Value;
16+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1617

1718
/**
1819
* Catalog product option default type
@@ -23,7 +24,7 @@
2324
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2425
* @since 100.0.2
2526
*/
26-
class DefaultType extends \Magento\Framework\DataObject
27+
class DefaultType extends \Magento\Framework\DataObject implements ResetAfterRequestInterface
2728
{
2829
/**
2930
* Option Instance
@@ -426,4 +427,12 @@ protected function _getChargeableOptionPrice($price, $isPercent, $basePrice)
426427
return $price;
427428
}
428429
}
430+
431+
/**
432+
* @inheritDoc
433+
*/
434+
public function _resetState(): void
435+
{
436+
$this->_productOptions = [];
437+
}
429438
}

app/code/Magento/Catalog/Model/Product/Price/TierPriceFactory.php

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

99
use Magento\Catalog\Api\Data\TierPriceInterface;
1010
use Magento\Framework\Exception\NoSuchEntityException;
11+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1112

12-
class TierPriceFactory
13+
class TierPriceFactory implements ResetAfterRequestInterface
1314
{
1415
/**
1516
* @var \Magento\Catalog\Api\Data\TierPriceInterfaceFactory
@@ -168,4 +169,12 @@ private function retrieveGroupValue($code)
168169

169170
return $this->customerGroupsByCode[$code];
170171
}
172+
173+
/**
174+
* @inheritDoc
175+
*/
176+
public function _resetState(): void
177+
{
178+
$this->customerGroupsByCode = [];
179+
}
171180
}

0 commit comments

Comments
 (0)