20 lines
627 B
PHP
20 lines
627 B
PHP
<?php
|
|
use Psr\Container\ContainerInterface;
|
|
|
|
return [
|
|
\Doctrine\DBAL\Connection::class => function(ContainerInterface $container) {
|
|
$config = $container->get('database')->databases['default'];
|
|
$conn = [
|
|
'dbname' => $config->name,
|
|
'user' => $config->user->name,
|
|
'password' => $config->user->password,
|
|
'host' => $config->host->name,
|
|
'driver' => $config->driver
|
|
];
|
|
if (isset($config->host->port)) {
|
|
$conn['port'] = $config->host->port;
|
|
}
|
|
return \Doctrine\DBAL\DriverManager::getConnection($conn);
|
|
}
|
|
];
|