Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
PostPluginInstallEvent example
// Makes sure the version is updated in the db after a re-installation
if
(
$plugin
->
getUpdateVersion
(
)
&&
$this
->
hasInfoNewerVersion
(
$plugin
->
getUpdateVersion
(
)
,
$plugin
->
getVersion
(
)
)
)
{
$plugin
->
setVersion
(
$plugin
->
getUpdateVersion
(
)
)
;
}
$this
->em->
flush
(
$plugin
)
;
$this
->
applyMigrations
(
$pluginBootstrap
, AbstractPluginMigration::MODUS_INSTALL
)
;
$pluginBootstrap
->
install
(
$context
)
;
$this
->events->
notify
(
PluginEvent::POST_INSTALL,
new
PostPluginInstallEvent
(
$context
,
$pluginBootstrap
)
)
;
$plugin
->
setInstalled
(
new
DateTime
(
)
)
;
$plugin
->
setUpdated
(
new
DateTime
(
)
)
;
$this
->em->
flush
(
$plugin
)
;
return
$context
;
}
/** * @param bool $removeData * * @throws Exception * @throws \Doctrine\DBAL\DBALException * @throws \Doctrine\ORM\OptimisticLockException * * @return UninstallContext */