public function enable(\Eccube\Entity\Plugin $plugin, $enable = true) { $pluginDir = $this->calcPluginDir($plugin->getName()); $em = $this->app['orm.em']; $plugin->setEnable($enable ? 1 : 0); $em->persist($plugin); $em->flush(); $this->callPluginManagerMethod(Yaml::Parse($pluginDir . '/' . self::CONFIG_YML), $enable ? 'enable' : 'disable'); return true; }
public function enable(\Eccube\Entity\Plugin $plugin, $enable = true) { $em = $this->app['orm.em']; try { $pluginDir = $this->calcPluginDir($plugin->getCode()); $em->getConnection()->beginTransaction(); $plugin->setEnable($enable ? Constant::ENABLED : Constant::DISABLED); $em->persist($plugin); $this->callPluginManagerMethod(Yaml::parse(file_get_contents($pluginDir . '/' . self::CONFIG_YML)), $enable ? 'enable' : 'disable'); $em->flush(); $em->getConnection()->commit(); } catch (\Exception $e) { $em->getConnection()->rollback(); throw $e; } return true; }