Skip to content

Commit 3aacfbf

Browse files
Merge branch 'ACPT-1552' into ACPT-1666
2 parents 8e1df76 + e2bcca1 commit 3aacfbf

File tree

48 files changed

+661
-306
lines changed

Some content is hidden

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

48 files changed

+661
-306
lines changed

app/code/Magento/Catalog/Model/Category/AttributeRepository.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
namespace Magento\Catalog\Model\Category;
77

88
use Magento\Catalog\Api\CategoryAttributeRepositoryInterface;
9+
use Magento\Framework\App\State\ReloadProcessorInterface;
910

10-
class AttributeRepository implements CategoryAttributeRepositoryInterface
11+
class AttributeRepository implements CategoryAttributeRepositoryInterface, ReloadProcessorInterface
1112
{
1213
/**
1314
* @var \Magento\Framework\Api\SearchCriteriaBuilder
@@ -30,7 +31,7 @@ class AttributeRepository implements CategoryAttributeRepositoryInterface
3031
private $eavConfig;
3132

3233
/**
33-
* @var array
34+
* @var array|null
3435
*/
3536
private $metadataCache;
3637

@@ -98,4 +99,14 @@ public function getCustomAttributesMetadata($dataObjectClassName = null)
9899
}
99100
return $this->metadataCache[$dataObjectClassName];
100101
}
102+
103+
/**
104+
* @inheritDoc
105+
*/
106+
public function reloadState(): void
107+
{
108+
$this->filterBuilder->_resetState();
109+
$this->searchCriteriaBuilder->_resetState();
110+
$this->metadataCache = null;
111+
}
101112
}

app/code/Magento/Catalog/etc/di.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,4 +1344,11 @@
13441344
</argument>
13451345
</arguments>
13461346
</type>
1347+
<type name="Magento\Framework\App\State\ReloadProcessorComposite">
1348+
<arguments>
1349+
<argument name="processors" xsi:type="array">
1350+
<item name="Magento_Catalog::AttributeRepository" xsi:type="object">Magento\Catalog\Model\Category\AttributeRepository</item>
1351+
</argument>
1352+
</arguments>
1353+
</type>
13471354
</config>

app/code/Magento/Customer/Model/Address/AbstractAddress.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ class AbstractAddress extends AbstractExtensibleModel implements AddressModelInt
6161
protected $_eventObject = 'customer_address';
6262

6363
/**
64-
* Directory country models
64+
* cache of Directory country models
6565
*
6666
* @var \Magento\Directory\Model\Country[]
6767
*/
68-
protected static $_countryModels = [];
68+
protected $_countryModels = [];
6969

7070
/**
71-
* Directory region models
71+
* cache of Directory region models
7272
*
7373
* @var \Magento\Directory\Model\Region[]
7474
*/
75-
protected static $_regionModels = [];
75+
protected $_regionModels = [];
7676

7777
/**
7878
* @var \Magento\Directory\Helper\Data
@@ -502,13 +502,12 @@ public function getCountry()
502502
*/
503503
public function getCountryModel()
504504
{
505-
if (!isset(self::$_countryModels[$this->getCountryId()])) {
505+
if (!isset($this->_countryModels[$this->getCountryId()])) {
506506
$country = $this->_createCountryInstance();
507507
$country->load($this->getCountryId());
508-
self::$_countryModels[$this->getCountryId()] = $country;
508+
$this->_countryModels[$this->getCountryId()] = $country;
509509
}
510-
511-
return self::$_countryModels[$this->getCountryId()];
510+
return $this->_countryModels[$this->getCountryId()];
512511
}
513512

514513
/**
@@ -523,13 +522,13 @@ public function getRegionModel($regionId = null)
523522
$regionId = $this->getRegionId();
524523
}
525524

526-
if (!isset(self::$_regionModels[$regionId])) {
525+
if (!isset($this->_regionModels[$regionId])) {
527526
$region = $this->_createRegionInstance();
528527
$region->load($regionId);
529-
self::$_regionModels[$regionId] = $region;
528+
$this->_regionModels[$regionId] = $region;
530529
}
531530

532-
return self::$_regionModels[$regionId];
531+
return $this->_regionModels[$regionId];
533532
}
534533

535534
/**
@@ -747,7 +746,7 @@ private function processCustomAttribute(array $attribute): array
747746
*/
748747
public function _resetState(): void
749748
{
750-
self::$_countryModels = [];
751-
self::$_regionModels = [];
749+
$this->_countryModels = [];
750+
$this->_regionModels = [];
752751
}
753752
}

app/code/Magento/Customer/Model/GroupRegistry.php

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

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

1213
/**
1314
* Registry for Customer Group models
1415
*/
15-
class GroupRegistry
16+
class GroupRegistry implements ResetAfterRequestInterface
1617
{
1718
/**
1819
* @var array
@@ -63,4 +64,12 @@ public function remove($groupId)
6364
{
6465
unset($this->registry[$groupId]);
6566
}
67+
68+
/**
69+
* @inheritDoc
70+
*/
71+
public function _resetState(): void
72+
{
73+
$this->registry = [];
74+
}
6675
}

app/code/Magento/Customer/Model/Indexer/AttributeProvider.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
*/
66
namespace Magento\Customer\Model\Indexer;
77

8+
use Magento\Customer\Model\Attribute;
89
use Magento\Customer\Model\Config\Source\FilterConditionType;
910
use Magento\Customer\Model\Customer;
10-
use Magento\Framework\Indexer\FieldsetInterface;
1111
use Magento\Eav\Model\Config;
12-
use Magento\Customer\Model\Attribute;
12+
use Magento\Framework\Indexer\FieldsetInterface;
13+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1314

14-
class AttributeProvider implements FieldsetInterface
15+
class AttributeProvider implements FieldsetInterface, ResetAfterRequestInterface
1516
{
1617
/**
1718
* EAV entity
@@ -37,6 +38,14 @@ public function __construct(
3738
$this->eavConfig = $eavConfig;
3839
}
3940

41+
/**
42+
* @inheritDoc
43+
*/
44+
public function _resetState(): void
45+
{
46+
$this->attributes = null;
47+
}
48+
4049
/**
4150
* Add EAV attribute fields to fieldset
4251
*

app/code/Magento/CustomerGraphQl/Model/Context/AddUserInfoToContext.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,25 @@
1111
use Magento\Customer\Api\Data\CustomerInterface;
1212
use Magento\Customer\Model\ResourceModel\CustomerRepository;
1313
use Magento\Customer\Model\Session;
14+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1415
use Magento\GraphQl\Model\Query\ContextParametersInterface;
1516
use Magento\GraphQl\Model\Query\UserContextParametersProcessorInterface;
1617

1718
/**
1819
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1920
*/
20-
class AddUserInfoToContext implements UserContextParametersProcessorInterface
21+
class AddUserInfoToContext implements UserContextParametersProcessorInterface, ResetAfterRequestInterface
2122
{
2223
/**
2324
* @var UserContextInterface
2425
*/
2526
private $userContext;
2627

28+
/**
29+
* @var UserContextInterface
30+
*/
31+
private UserContextInterface $userContextFromConstructor;
32+
2733
/**
2834
* @var Session
2935
*/
@@ -45,10 +51,19 @@ public function __construct(
4551
CustomerRepository $customerRepository
4652
) {
4753
$this->userContext = $userContext;
54+
$this->userContextFromConstructor = $userContext;
4855
$this->session = $session;
4956
$this->customerRepository = $customerRepository;
5057
}
5158

59+
/**
60+
* @inheritDoc
61+
*/
62+
public function _resetState(): void
63+
{
64+
$this->userContext = $this->userContextFromConstructor;
65+
}
66+
5267
/**
5368
* @inheritdoc
5469
*/

app/code/Magento/Directory/Model/Country.php

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

77
namespace Magento\Directory\Model;
88

9+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
10+
911
/**
1012
* Country model
1113
*
@@ -16,7 +18,7 @@
1618
* @since 100.0.2
1719
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1820
*/
19-
class Country extends \Magento\Framework\Model\AbstractModel
21+
class Country extends \Magento\Framework\Model\AbstractModel implements ResetAfterRequestInterface
2022
{
2123
/**
2224
* @var array

app/code/Magento/Integration/Model/CustomUserContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ class CustomUserContext implements UserContextInterface
1515
/**
1616
* @var int|null
1717
*/
18-
private $userId;
18+
private readonly ?int $userId;
1919

2020
/**
2121
* @var int|null
2222
*/
23-
private $userType;
23+
private readonly ?int $userType;
2424

2525
/**
2626
* @param int|null $userId

app/code/Magento/JwtUserToken/Model/Data/JwtUserContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ class JwtUserContext implements UserContextInterface
1515
/**
1616
* @var int|null
1717
*/
18-
private $userId;
18+
private readonly ?int $userId;
1919

2020
/**
2121
* @var int|null
2222
*/
23-
private $userType;
23+
private readonly ?int $userType;
2424

2525
/**
2626
* @param int|null $userId

app/code/Magento/Quote/Model/Quote/Address/Total/AbstractTotal.php

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Quote\Model\Quote\Address\Total;
77

8+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
9+
810
/**
911
* Sales Quote Address Total abstract model
1012
*
@@ -13,7 +15,7 @@
1315
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
1416
* @since 100.0.2
1517
*/
16-
abstract class AbstractTotal implements CollectorInterface, ReaderInterface
18+
abstract class AbstractTotal implements CollectorInterface, ReaderInterface, ResetAfterRequestInterface
1719
{
1820
/**
1921
* Total Code name
@@ -48,6 +50,24 @@ abstract class AbstractTotal implements CollectorInterface, ReaderInterface
4850
*/
4951
protected $_itemRowTotalKey = null;
5052

53+
/**
54+
* @var \Magento\Quote\Model\Quote\Address\Total
55+
*/
56+
protected $total;
57+
58+
/**
59+
* @inheritDoc
60+
*/
61+
public function _resetState(): void
62+
{
63+
$this->_code = null;
64+
$this->_address = null;
65+
$this->_canAddAmountToAddress = true;
66+
$this->_canSetAddressAmount = true;
67+
$this->_itemRowTotalKey = null;
68+
$this->total = null;
69+
}
70+
5171
/**
5272
* Set total code code name
5373
*
@@ -142,11 +162,6 @@ protected function _getAddress()
142162
return $this->_address;
143163
}
144164

145-
/**
146-
* @var \Magento\Quote\Model\Quote\Address\Total
147-
*/
148-
protected $total;
149-
150165
/**
151166
* @param \Magento\Quote\Model\Quote\Address\Total $total
152167
* @return $this

0 commit comments

Comments
 (0)