File tree Expand file tree Collapse file tree 4 files changed +36
-19
lines changed
app/code/Magento/Store/Model
Config/Importer/Processor Expand file tree Collapse file tree 4 files changed +36
-19
lines changed Original file line number Diff line number Diff line change @@ -168,10 +168,11 @@ private function deleteStores(array $items)
168
168
169
169
foreach ($ items as $ storeCode ) {
170
170
$ store = $ this ->storeRepository ->get ($ storeCode );
171
- $ store ->getResource ()->delete ($ store );
172
- $ store ->getResource ()->addCommitCallback (function () use ($ store ) {
173
- $ this ->eventManager ->dispatch ('store_delete ' , ['store ' => $ store ]);
174
- });
171
+ $ store ->delete ();
172
+ // $store->getResource()->delete($store);
173
+ // $store->getResource()->addCommitCallback(function () use ($store) {
174
+ // $this->eventManager->dispatch('store_delete', ['store' => $store]);
175
+ // });
175
176
}
176
177
}
177
178
Original file line number Diff line number Diff line change @@ -176,10 +176,11 @@ private function updateStores(array $items, array $data)
176
176
$ store ->setGroup ($ group );
177
177
}
178
178
179
- $ store ->getResource ()->save ($ store );
180
- $ store ->getResource ()->addCommitCallback (function () use ($ store ) {
181
- $ this ->eventManager ->dispatch ('store_edit ' , ['store ' => $ store ]);
182
- });
179
+ $ store ->save ();
180
+ // $store->getResource()->save($store);
181
+ // $store->getResource()->addCommitCallback(function () use ($store) {
182
+ // $this->eventManager->dispatch('store_edit', ['store' => $store]);
183
+ // });
183
184
}
184
185
}
185
186
@@ -214,11 +215,11 @@ private function updateGroups(array $items, array $data)
214
215
if ($ website && $ website ->getId () != $ group ->getWebsiteId ()) {
215
216
$ group ->setWebsite ($ website );
216
217
}
217
-
218
- $ group ->getResource ()->save ($ group );
219
- $ group ->getResource ()->addCommitCallback (function () use ($ group ) {
220
- $ this ->eventManager ->dispatch ('store_group_save ' , ['group ' => $ group ]);
221
- });
218
+ $ group -> save ();
219
+ // $group->getResource()->save($group);
220
+ // $group->getResource()->addCommitCallback(function () use ($group) {
221
+ // $this->eventManager->dispatch('store_group_save', ['group' => $group]);
222
+ // });
222
223
}
223
224
}
224
225
Original file line number Diff line number Diff line change @@ -414,8 +414,12 @@ public function beforeDelete()
414
414
*/
415
415
public function afterDelete ()
416
416
{
417
- $ result = parent ::afterDelete ();
418
417
$ this ->_storeManager ->reinitStores ();
418
+ $ group = $ this ;
419
+ $ this ->getResource ()->addCommitCallback (function () use ($ group ) {
420
+ $ this ->_storeManager ->reinitStores ();
421
+ $ this ->eventManager ->dispatch ($ this ->_eventPrefix . '_delete ' , ['group ' => $ group ]);
422
+ });
419
423
420
424
if ($ this ->getId () === $ this ->getWebsite ()->getDefaultGroupId ()) {
421
425
$ ids = $ this ->getWebsite ()->getGroupIds ();
@@ -428,7 +432,7 @@ public function afterDelete()
428
432
$ this ->getWebsite ()->setDefaultGroupId ($ defaultId );
429
433
$ this ->getWebsite ()->save ();
430
434
}
431
- return $ result ;
435
+ return parent :: afterDelete () ;
432
436
}
433
437
434
438
/**
@@ -437,8 +441,11 @@ public function afterDelete()
437
441
public function afterSave ()
438
442
{
439
443
$ this ->_storeManager ->reinitStores ();
440
- $ this ->eventManager ->dispatch ($ this ->_eventPrefix . '_save ' , ['group ' => $ this ]);
441
-
444
+ $ group = $ this ;
445
+ $ this ->getResource ()->addCommitCallback (function () use ($ group ) {
446
+ $ this ->_storeManager ->reinitStores ();
447
+ $ this ->eventManager ->dispatch ($ this ->_eventPrefix . '_save ' , ['group ' => $ group ]);
448
+ });
442
449
return parent ::afterSave ();
443
450
}
444
451
Original file line number Diff line number Diff line change @@ -1062,7 +1062,11 @@ public function afterSave()
1062
1062
} else {
1063
1063
$ event = $ this ->_eventPrefix . '_edit ' ;
1064
1064
}
1065
- $ this ->eventManager ->dispatch ($ event , ['store ' => $ this ]);
1065
+ $ store = $ this ;
1066
+ $ this ->getResource ()->addCommitCallback (function () use ($ event , $ store ) {
1067
+ $ this ->_storeManager ->reinitStores ();
1068
+ $ this ->eventManager ->dispatch ($ event , ['store ' => $ store ]);
1069
+ });
1066
1070
return parent ::afterSave ();
1067
1071
}
1068
1072
@@ -1258,7 +1262,11 @@ public function afterDelete()
1258
1262
$ this ->getGroup ()->setDefaultStoreId ($ defaultId );
1259
1263
$ this ->getGroup ()->save ();
1260
1264
}
1261
-
1265
+ $ store = $ this ;
1266
+ $ this ->getResource ()->addCommitCallback (function () use ($ store ) {
1267
+ $ this ->_storeManager ->reinitStores ();
1268
+ $ this ->eventManager ->dispatch ($ this ->_eventPrefix . '_delete ' , ['store ' => $ store ]);
1269
+ });
1262
1270
return $ this ;
1263
1271
}
1264
1272
You can’t perform that action at this time.
0 commit comments