Set up the CycleORM DBAL
This commit is contained in:
parent
6742ffa671
commit
13aa57512d
433
app/composer.lock
generated
433
app/composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,9 @@ use Odan\Session\PhpSession;
|
|||||||
use Odan\Session\SessionInterface;
|
use Odan\Session\SessionInterface;
|
||||||
use Odan\Session\SessionManagerInterface;
|
use Odan\Session\SessionManagerInterface;
|
||||||
|
|
||||||
|
use Cycle\Database as CycleDatabase;
|
||||||
|
use Cycle\Database\Config as CycleConfig;
|
||||||
|
|
||||||
use Psr\Container\ContainerExceptionInterface;
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
use Psr\Container\NotFoundExceptionInterface;
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
@ -175,6 +178,33 @@ class Bootstrap
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'dbal' => function (ContainerInterface $container) {
|
||||||
|
$config = $container->get('config');
|
||||||
|
|
||||||
|
$tcpConnectionConfig = new CycleConfig\MySQL\TcpConnectionConfig(
|
||||||
|
database: $config->get('database.database'),
|
||||||
|
host: $config->get('database.host'),
|
||||||
|
user: $config->get('database.username'),
|
||||||
|
password: $config->get('database.password'),
|
||||||
|
port: 3306
|
||||||
|
);
|
||||||
|
|
||||||
|
$driverConfig = new CycleConfig\MySQLDriverConfig(
|
||||||
|
connection: $tcpConnectionConfig,
|
||||||
|
queryCache: true
|
||||||
|
);
|
||||||
|
|
||||||
|
return new CycleDatabase\DatabaseManager(
|
||||||
|
new CycleConfig\DatabaseConfig([
|
||||||
|
'default' => 'default',
|
||||||
|
'databases' => [
|
||||||
|
'default' => [ 'connection' => 'mysql' ]
|
||||||
|
],
|
||||||
|
'connections' => [ 'mysql' => $driverConfig ],
|
||||||
|
])
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FlySystem set up
|
* FlySystem set up
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user