Skip to content

Commit 22a07ee

Browse files
ACPT-1327
adding resetState for Magento/SalesRule/Model/Validator
1 parent b4f9b1f commit 22a07ee

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

app/code/Magento/SalesRule/Model/Validator.php

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

99
use Laminas\Validator\ValidatorInterface;
1010
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1112
use Magento\Quote\Model\Quote;
1213
use Magento\Quote\Model\Quote\Address;
1314
use Magento\Quote\Model\Quote\Item\AbstractItem;
@@ -28,7 +29,7 @@
2829
* @method Validator setCustomerGroupId($id)
2930
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3031
*/
31-
class Validator extends \Magento\Framework\Model\AbstractModel
32+
class Validator extends \Magento\Framework\Model\AbstractModel implements ResetAfterRequestInterface
3233
{
3334
/**
3435
* Rule source collection
@@ -151,6 +152,18 @@ public function __construct(
151152
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
152153
}
153154

155+
/**
156+
* @inheritDoc
157+
*/
158+
public function _resetState(): void
159+
{
160+
$this->counter = 0;
161+
$this->_skipActionsValidation = false;
162+
$this->_rulesItemTotals = [];
163+
$this->_isFirstTimeResetRun = true;
164+
$this->_rules = null;
165+
}
166+
154167
/**
155168
* Init validator
156169
* Init process load collection of rules for specific website,

0 commit comments

Comments
 (0)