$context =
new UninstallContext($plugin,
$this->release->
getVersion(),
$plugin->
getVersion(), !
$removeData);
$bootstrap =
$this->
getPluginByName($plugin->
getName());
$this->events->
notify(PluginEvent::PRE_DEACTIVATE,
new PrePluginDeactivateEvent($context,
$bootstrap));
$this->events->
notify(PluginEvent::PRE_UNINSTALL,
new PrePluginUninstallEvent($context,
$bootstrap));
$this->
applyMigrations($bootstrap, AbstractPluginMigration::MODUS_UNINSTALL, !
$removeData);
$bootstrap->
uninstall($context);
$plugin->
setInstalled(null
);
$plugin->
setActive(false
);
$this->events->
notify(PluginEvent::POST_UNINSTALL,
new PostPluginUninstallEvent($context,
$bootstrap));
$this->events->
notify(PluginEvent::POST_DEACTIVATE,
new PostPluginDeactivateEvent($context,
$bootstrap));
$this->em->
flush($plugin);
$pluginId =
$plugin->
getId();
$this->
removeEventSubscribers($pluginId);
$this->
removeCrontabEntries($pluginId);
$this->
removeMenuEntries($pluginId);