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
4242 */
4343 private $ filterBuilder ;
4444
45+ /**
46+ * @var AttributeInterface[]
47+ */
48+ private $ attributes ;
49+
4550 /**
4651 * @param ScopeOverriddenValue $scopeOverriddenValue
4752 * @param AttributeRepository $attributeRepository
@@ -120,8 +125,12 @@ function () {
120125 *
121126 * @return AttributeInterface[]
122127 */
123- private function getAttributes ()
128+ private function getAttributes (): array
124129 {
130+ if ($ this ->attributes ) {
131+ return $ this ->attributes ;
132+ }
133+
125134 $ searchResult = $ this ->attributeRepository ->getList (
126135 $ this ->searchCriteriaBuilder ->addFilters (
127136 [
@@ -133,11 +142,12 @@ private function getAttributes()
133142 ]
134143 )->create ()
135144 );
136- $ result = [];
145+
146+ $ this ->attributes = [];
137147 foreach ($ searchResult ->getItems () as $ attribute ) {
138- $ result [$ attribute ->getAttributeCode ()] = $ attribute ;
148+ $ this -> attributes [$ attribute ->getAttributeCode ()] = $ attribute ;
139149 }
140150
141- return $ result ;
151+ return $ this -> attributes ;
142152 }
143153}
You can’t perform that action at this time.
0 commit comments