Skip to content

Commit d5d95c1

Browse files
committed
ACPT-1052: Some Luma Storefront Scenarios Are Broken
1 parent 3f466a8 commit d5d95c1

File tree

8 files changed

+89
-11
lines changed

8 files changed

+89
-11
lines changed

app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/Builder/Aggregations/Category/IncludeDirectChildrenOnly.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Catalog\Api\CategoryListInterface;
1111
use Magento\Framework\Api\SearchCriteriaBuilder;
12+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1213
use Magento\Framework\Search\Response\Aggregation;
1314
use Magento\Framework\Search\Response\AggregationFactory;
1415
use Magento\Framework\Search\Response\BucketFactory;
@@ -18,7 +19,7 @@
1819
/**
1920
* Class to include only direct subcategories of category in aggregation
2021
*/
21-
class IncludeDirectChildrenOnly
22+
class IncludeDirectChildrenOnly implements ResetAfterRequestInterface
2223
{
2324
/**
2425
* @var string
@@ -160,4 +161,12 @@ private function filterBucketValues(
160161
}
161162
return array_values($categoryBucketValues);
162163
}
164+
165+
/**
166+
* @inheritDoc
167+
*/
168+
public function _resetState(): void
169+
{
170+
$this->filter = [];
171+
}
163172
}

app/code/Magento/Directory/Helper/Data.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Magento\Framework\App\Helper\AbstractHelper;
1717
use Magento\Framework\App\Helper\Context;
1818
use Magento\Framework\Json\Helper\Data as JsonData;
19+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1920
use Magento\Store\Model\ScopeInterface;
2021
use Magento\Store\Model\StoreManagerInterface;
2122

@@ -26,7 +27,7 @@
2627
* @since 100.0.2
2728
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2829
*/
29-
class Data extends AbstractHelper
30+
class Data extends AbstractHelper implements ResetAfterRequestInterface
3031
{
3132
private const STORE_ID = 'store_id';
3233

@@ -435,4 +436,13 @@ private function getCurrentScope(): array
435436

436437
return $scope;
437438
}
439+
440+
/**
441+
* @inheritDoc
442+
*/
443+
public function _resetState(): void
444+
{
445+
$this->_regionJson = null;
446+
$this->_currencyCache = [];
447+
}
438448
}

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Magento\Framework\Model\ResourceModel\AbstractResource;
2323
use Magento\Framework\Model\ResourceModel\Db\ObjectRelationProcessor;
2424
use Magento\Framework\Model\ResourceModel\Db\TransactionManagerInterface;
25+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
2526

2627
/**
2728
* Entity/Attribute/Model - entity abstract
@@ -34,7 +35,8 @@
3435
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3536
* @since 100.0.2
3637
*/
37-
abstract class AbstractEntity extends AbstractResource implements EntityInterface, DefaultAttributesProvider
38+
abstract class AbstractEntity extends AbstractResource implements EntityInterface, DefaultAttributesProvider,
39+
ResetAfterRequestInterface
3840
{
3941
/**
4042
* @var \Magento\Eav\Model\Entity\AttributeLoaderInterface
@@ -2021,4 +2023,18 @@ protected function loadAttributesForObject($attributes, $object = null)
20212023
}
20222024
}
20232025
}
2026+
2027+
/**
2028+
* @inheritDoc
2029+
*/
2030+
public function _resetState(): void
2031+
{
2032+
$this->_attributesByCode = [];
2033+
$this->attributesByScope = [];
2034+
$this->_attributesByTable = [];
2035+
$this->_staticAttributes = [];
2036+
$this->_attributeValuesToDelete = [];
2037+
$this->_attributeValuesToSave = [];
2038+
self::$_attributeBackendTables = [];
2039+
}
20242040
}

app/code/Magento/Email/Model/Template/Filter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,16 +1124,16 @@ public function filter($value)
11241124
try {
11251125
$value = parent::filter($value);
11261126
} catch (Exception $e) {
1127-
// Since a single instance of this class can be used to filter content multiple times, reset callbacks to
1128-
// prevent callbacks running for unrelated content (e.g., email subject and email body)
1129-
$this->resetAfterFilterCallbacks();
1130-
11311127
if ($this->_appState->getMode() == State::MODE_DEVELOPER) {
11321128
$value = sprintf(__('Error filtering template: %s')->render(), $e->getMessage());
11331129
} else {
11341130
$value = (string) __("We're sorry, an error has occurred while generating this content.");
11351131
}
11361132
$this->_logger->critical($e);
1133+
} finally {
1134+
// Since a single instance of this class can be used to filter content multiple times, reset callbacks to
1135+
// prevent callbacks running for unrelated content (e.g., email subject and email body)
1136+
$this->resetAfterFilterCallbacks();
11371137
}
11381138
return $value;
11391139
}

app/code/Magento/GraphQlCache/Model/CacheableQuery.php

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

88
namespace Magento\GraphQlCache\Model;
99

10+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
11+
1012
/**
1113
* CacheableQuery should be used as a singleton for collecting HTTP cache-related info and tags of all entities.
1214
*/
13-
class CacheableQuery
15+
class CacheableQuery implements ResetAfterRequestInterface
1416
{
1517
/**
1618
* @var string[]
@@ -75,4 +77,13 @@ public function shouldPopulateCacheHeadersWithTags() : bool
7577

7678
return !empty($cacheTags) && $isQueryCacheable;
7779
}
80+
81+
/**
82+
* @inheritDoc
83+
*/
84+
public function _resetState(): void
85+
{
86+
$this->cacheTags = [];
87+
$this->cacheable = true;
88+
}
7889
}

app/code/Magento/Tax/Model/Calculation.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Framework\Api\FilterBuilder;
1616
use Magento\Framework\Api\SearchCriteriaBuilder;
1717
use Magento\Framework\Exception\NoSuchEntityException;
18+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1819
use Magento\Framework\Pricing\PriceCurrencyInterface;
1920
use Magento\Store\Model\Store;
2021
use Magento\Tax\Api\TaxClassRepositoryInterface;
@@ -24,7 +25,7 @@
2425
* @SuppressWarnings(PHPMD.TooManyFields)
2526
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2627
*/
27-
class Calculation extends \Magento\Framework\Model\AbstractModel
28+
class Calculation extends \Magento\Framework\Model\AbstractModel implements ResetAfterRequestInterface
2829
{
2930
/**
3031
* Identifier constant for Tax calculation before discount excluding TAX
@@ -720,4 +721,16 @@ public function getTaxRates($billingAddress, $shippingAddress, $customerTaxClass
720721
}
721722
return $productRates;
722723
}
724+
725+
/**
726+
* @inheritDoc
727+
*/
728+
public function _resetState(): void
729+
{
730+
$this->_rates = [];
731+
$this->_ctc = [];
732+
$this->_ptc = [];
733+
$this->_rateCache = [];
734+
$this->_rateCalculationProcess = [];
735+
}
723736
}

app/code/Magento/Tax/Model/ClassModelRegistry.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
namespace Magento\Tax\Model;
88

99
use Magento\Framework\Exception\NoSuchEntityException;
10+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1011
use Magento\Tax\Model\ClassModel as TaxClassModel;
1112
use Magento\Tax\Model\ClassModelFactory as TaxClassModelFactory;
1213

1314
/**
1415
* Registry for the tax class models
1516
*/
16-
class ClassModelRegistry
17+
class ClassModelRegistry implements ResetAfterRequestInterface
1718
{
1819
/**
1920
* Tax class model factory
@@ -82,4 +83,12 @@ public function remove($taxClassId)
8283
{
8384
unset($this->taxClassRegistryById[$taxClassId]);
8485
}
86+
87+
/**
88+
* @inheritDoc
89+
*/
90+
public function _resetState(): void
91+
{
92+
$this->taxClassRegistryById = [];
93+
}
8594
}

app/code/Magento/Tax/Model/TaxCalculation.php

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

77
namespace Magento\Tax\Model;
88

9+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
910
use Magento\Tax\Api\TaxCalculationInterface;
1011
use Magento\Tax\Api\TaxClassManagementInterface;
1112
use Magento\Tax\Api\Data\TaxDetailsItemInterface;
@@ -23,7 +24,7 @@
2324
/**
2425
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2526
*/
26-
class TaxCalculation implements TaxCalculationInterface
27+
class TaxCalculation implements TaxCalculationInterface, ResetAfterRequestInterface
2728
{
2829
/**
2930
* Tax Details factory
@@ -386,4 +387,13 @@ protected function getTotalQuantity(QuoteDetailsItemInterface $item)
386387
}
387388
return $item->getQuantity();
388389
}
390+
391+
/**
392+
* @inheritDoc
393+
*/
394+
public function _resetState(): void
395+
{
396+
$this->keyedItems = [];
397+
$this->parentToChildren = [];
398+
}
389399
}

0 commit comments

Comments
 (0)