This commit is contained in:
2021-11-30 18:04:41 -03:00
parent 87323b22d8
commit f589ff960b
56 changed files with 1960 additions and 0 deletions

24
setup/databases.php Normal file
View File

@ -0,0 +1,24 @@
<?php
$database = $app->getContainer()->get('database');
foreach ($database->databases as $name => $settings) {
switch (strtolower($settings->engine)) {
case 'mysql':
$dsn = "mysql:host={$settings->host->name};dbname={$settings->name}" . (isset($settings->host->port) ? ';port=' . $settings->host->port : '');
ORM::configure([
'connection_string' => $dsn,
'username' => $settings->user->name,
'password' => $settings->user->password
], null, $name);
break;
}
if (isset($settings->logging) and $settings->logging) {
ORM::configure('logging', true, $name);
}
if (isset($settings->caching) and $settings->caching) {
ORM::configure('caching', true, $name);
}
}
if (isset($database->short_names) and $database->short_names) {
Model::$short_table_names = true;
}