Example #1
0
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     foreach ($this->loader->getItems() as $component) {
         $module = $this->moduleFactory->create()->load($component['code']);
         $module->addData($component);
         $module->save();
     }
 }
Example #2
0
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     foreach ($observer->getModuleCollection() as $module) {
         $component = $this->loader->getItemById($module->getCode());
         if (!$component) {
             $this->moduleFactory->create()->load($module->getCode())->delete();
             continue;
         }
         $module->addData($component);
     }
 }