@@ -144,32 +144,21 @@ public function convertSerializedDataToJson($setup)
144
144
*/
145
145
public function fillSalesRuleProductAttributeTable ()
146
146
{
147
- $ ruleCollection = $ this ->getRuleColletion ();
147
+ /** @var ResourceModelRule\Collection $ruleCollection */
148
+ $ ruleCollection = $ this ->ruleColletionFactory ->create ();
148
149
/** @var ModelRule $rule */
149
150
foreach ($ ruleCollection as $ rule ) {
150
151
// Save product attributes used in rule
151
- $ ruleProductAttributes = array_merge (
152
- $ this ->resourceModelRule ->getProductAttributes (
153
- $ this ->serializer ->serialize ($ rule ->getConditions ()->asArray ())
154
- ),
155
- $ this ->resourceModelRule ->getProductAttributes (
156
- $ this ->serializer ->serialize ($ rule ->getActions ()->asArray ())
157
- )
158
- );
159
- if (count ($ ruleProductAttributes )) {
152
+ $ conditions = $ rule ->getConditions ()->asArray ();
153
+ $ actions = $ rule ->getActions ()->asArray ();
154
+ $ serializedConditions = $ this ->serializer ->serialize ($ conditions );
155
+ $ serializedActions = $ this ->serializer ->serialize ($ actions );
156
+ $ conditionAttributes = $ this ->resourceModelRule ->getProductAttributes ($ serializedConditions );
157
+ $ actionAttributes = $ this ->resourceModelRule ->getProductAttributes ($ serializedActions );
158
+ $ ruleProductAttributes = array_merge ($ conditionAttributes , $ actionAttributes );
159
+ if ($ ruleProductAttributes ) {
160
160
$ this ->resourceModelRule ->setActualProductAttributes ($ rule , $ ruleProductAttributes );
161
161
}
162
162
}
163
163
}
164
-
165
- /**
166
- * Get sales rule collection.
167
- *
168
- * @deprecated
169
- * @return ResourceModelRule\Collection
170
- */
171
- private function getRuleColletion ()
172
- {
173
- return $ this ->ruleColletionFactory ->create ();
174
- }
175
164
}
0 commit comments