1 | <?php |
||
2 | /** |
||
3 | * Configuration file for database query builder service. |
||
4 | */ |
||
5 | return [ |
||
6 | // Services to add to the container. |
||
7 | "services" => [ |
||
8 | "dbqb" => [ |
||
9 | "shared" => true, |
||
10 | "callback" => function () { |
||
11 | $db = new \Anax\DatabaseQueryBuilder\DatabaseQueryBuilder(); |
||
12 | |||
13 | // Load the configuration files |
||
14 | $cfg = $this->get("configuration"); |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||
15 | $config = $cfg->load("database"); |
||
16 | |||
17 | // Set the database configuration |
||
18 | $connection = $config["config"] ?? []; |
||
19 | $db->setOptions($connection); |
||
20 | $db->setDefaultsFromConfiguration(); |
||
21 | |||
22 | return $db; |
||
23 | } |
||
24 | ], |
||
25 | ], |
||
26 | ]; |
||
27 |