File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
app/code/Magento/Catalog/Model/CategoryRepository Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ class PopulateWithValues
42
42
*/
43
43
private $ filterBuilder ;
44
44
45
+ /**
46
+ * @var AttributeInterface[]
47
+ */
48
+ private $ attributes ;
49
+
45
50
/**
46
51
* @param ScopeOverriddenValue $scopeOverriddenValue
47
52
* @param AttributeRepository $attributeRepository
@@ -120,8 +125,12 @@ function () {
120
125
*
121
126
* @return AttributeInterface[]
122
127
*/
123
- private function getAttributes ()
128
+ private function getAttributes (): array
124
129
{
130
+ if ($ this ->attributes ) {
131
+ return $ this ->attributes ;
132
+ }
133
+
125
134
$ searchResult = $ this ->attributeRepository ->getList (
126
135
$ this ->searchCriteriaBuilder ->addFilters (
127
136
[
@@ -133,11 +142,12 @@ private function getAttributes()
133
142
]
134
143
)->create ()
135
144
);
136
- $ result = [];
145
+
146
+ $ this ->attributes = [];
137
147
foreach ($ searchResult ->getItems () as $ attribute ) {
138
- $ result [$ attribute ->getAttributeCode ()] = $ attribute ;
148
+ $ this -> attributes [$ attribute ->getAttributeCode ()] = $ attribute ;
139
149
}
140
150
141
- return $ result ;
151
+ return $ this -> attributes ;
142
152
}
143
153
}
You can’t perform that action at this time.
0 commit comments