Esempio n. 1
0
 private function updateActions(Module $model, ModuleSchema $module)
 {
     $actions = [];
     foreach ($module->getActionNames() as $name) {
         $action = $module->getAction($name);
         $a = new Action();
         $a->setName($name);
         $a->setModule($model);
         $a->setTitle($action->getTitle());
         $a->setDescription($action->getDescription());
         $a->setClassName($action->getClass());
         // add acl
         foreach ($action->getAcl() as $group) {
             $a->addGroup($this->getGroup($group));
         }
         $a->save();
         $actions[$name] = $a->getId();
     }
     // remove obsolete actions
     ActionQuery::create()->filterByModule($model)->where('Action.Name NOT IN ?', $module->getActionNames()->toArray())->delete();
     return $actions;
 }