Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
initDatabaseConnection example
$connectionInfo
=
$this
->
getConnectionInfoFromConfig
(
SW_PATH . '/config.php',
$connectionInfo
)
;
$connectionInfo
=
$this
->
getConnectionInfoFromArgs
(
$input
,
$connectionInfo
)
;
$connectionInfo
=
$this
->
getConnectionInfoFromInteractiveShell
(
$this
->IOHelper,
$connectionInfo
)
;
/** @var ConfigWriter $configWriter */
$configWriter
=
$this
->container->
offsetGet
(
'config.writer'
)
;
$configWriter
->
writeConfig
(
$connectionInfo
)
;
$conn
=
$this
->
initDatabaseConnection
(
$connectionInfo
,
$container
)
;
$databaseService
=
new
DatabaseService
(
$conn
)
;
$databaseService
->
createDatabase
(
$connectionInfo
->databaseName
)
;
$databaseService
->
selectDatabase
(
$connectionInfo
->databaseName
)
;
$skipImport
=
$databaseService
->
containsShopwareSchema
(
)
&&
$input
->
getOption
(
'no-skip-import'
)
&&
$this
->
shouldSkipImport
(
)
;
if
(
!
$skipImport
)
{
$this
->
importDatabase
(
)
;