Skip to content

Commit b1dfff8

Browse files
authored
Add caching for product attributes used in sales rules
Simplify code
1 parent 5a1b7e0 commit b1dfff8

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

app/code/Magento/SalesRule/Model/Plugin/QuoteConfigProductAttributes.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,11 @@ public function __construct(RuleResource $ruleResource)
4242
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4343
*/
4444
public function afterGetProductAttributes(Config $subject, array $attributeKeys): array
45-
{
46-
return array_merge($attributeKeys, $this->getActiveAttributeCodes());
47-
}
48-
49-
/**
50-
* @return array
51-
*/
52-
private function getActiveAttributeCodes(): array
5345
{
5446
if ($this->activeAttributeCodes === null) {
5547
$this->activeAttributeCodes = array_column($this->ruleResource->getActiveAttributes(), 'attribute_code');
5648
}
5749

58-
return $this->activeAttributeCodes;
50+
return array_merge($attributeKeys, $this->activeAttributeCodes);
5951
}
6052
}

0 commit comments

Comments
 (0)