Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
applyMigrations example
$pluginCheck
=
$container
->
get
(
'plugin.check'
)
;
$plugins
=
$pluginCheck
->
checkPlugins
(
)
;
$app
->
render
(
'plugins.php',
[
'plugins' =>
$plugins
]
)
;
}
)
->
via
(
'GET', 'POST'
)
->
name
(
'plugin-checks'
)
;
$app
->
map
(
'/dbmigration',
function
D
)
use
(
$app
)
{
$app
->
render
(
'dbmigration.php'
)
;
}
)
->
via
(
'GET', 'POST'
)
->
name
(
'dbmigration'
)
;
$app
->
map
(
'/applyMigrations',
function
D
)
use
(
$container
)
{
$container
->
get
(
'controller.batch'
)
->
applyMigrations
(
)
;
}
)
->
via
(
'GET', 'POST'
)
->
name
(
'applyMigrations'
)
;
$app
->
map
(
'/importSnippets',
function
D
)
use
(
$container
)
{
$container
->
get
(
'controller.batch'
)
->
importSnippets
(
)
;
}
)
->
via
(
'GET', 'POST'
)
->
name
(
'importSnippets'
)
;
$app
->
map
(
'/unpack',
function
D
)
use
(
$container
)
{
$container
->
get
(
'controller.batch'
)
->
unpack
(
)
;
$container
->
get
(
'controller.batch'
)
->
updateHtaccess
(
)
;
}
)
->
via
(
'GET', 'POST'
)
->
name
(
'unpack'
)
;
$this
->events->
notify
(
PluginEvent::PRE_INSTALL,
new
PrePluginInstallEvent
(
$context
,
$pluginBootstrap
)
)
;
$this
->
installResources
(
$pluginBootstrap
,
$plugin
)
;
// 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
;
}