Issues (28)

config/config.php (2 issues)

Labels
Severity
1
<?php
2
3
use Lagdo\DbAdmin\Db\Exception\DbException;
4
5
use function Jaxon\jaxon;
6
7
return [
8
    'metadata' => 'annotations',
9
    'directories' => [
10
        [
11
            'path' => __DIR__ . '/../app/ajax/App',
12
            'namespace' => 'Lagdo\\DbAdmin\\Ajax\\App',
13
            'autoload' => false,
14
        ],
15
    ],
16
    'views' => [
17
        'dbadmin::codes' => [
18
            'directory' => __DIR__ . '/../templates/codes',
19
            'extension' => '',
20
            'renderer' => 'jaxon',
21
        ],
22
        'dbadmin::views' => [
23
            'directory' => __DIR__ . '/../templates/views',
24
            'extension' => '.php',
25
            'renderer' => 'jaxon',
26
        ],
27
        'dbadmin::templates' => [
28
            'directory' => __DIR__ . '/../templates/views',
29
            'extension' => '.php',
30
            'renderer' => 'jaxon',
31
        ],
32
        'pagination' => [
33
            'directory' => __DIR__ . '/../templates/pagination',
34
            'extension' => '.php',
35
            'renderer' => 'jaxon',
36
        ],
37
    ],
38
    'container' => [
39
        'set' => [
40
            // Selected database driver
41
            Lagdo\DbAdmin\Driver\DriverInterface::class => function($di) {
42
                // The key below is defined by the corresponding plugin package.
43
                return $di->g('dbadmin_driver_' . $di->g('dbadmin_config_driver'));
44
            },
45
            // Facades to the DB driver features
46
            Lagdo\DbAdmin\Db\Facades\CommandFacade::class => function($di) {
47
                $dbFacade = $di->g(Lagdo\DbAdmin\Db\DbFacade::class);
48
                return new Lagdo\DbAdmin\Db\Facades\CommandFacade($dbFacade);
49
            },
50
            Lagdo\DbAdmin\Db\Facades\DatabaseFacade::class => function($di) {
51
                $dbFacade = $di->g(Lagdo\DbAdmin\Db\DbFacade::class);
52
                return new Lagdo\DbAdmin\Db\Facades\DatabaseFacade($dbFacade, $dbFacade->getServerOptions());
53
            },
54
            Lagdo\DbAdmin\Db\Facades\ExportFacade::class => function($di) {
55
                $dbFacade = $di->g(Lagdo\DbAdmin\Db\DbFacade::class);
56
                return new Lagdo\DbAdmin\Db\Facades\ExportFacade($dbFacade);
57
            },
58
            Lagdo\DbAdmin\Db\Facades\ImportFacade::class => function($di) {
59
                $dbFacade = $di->g(Lagdo\DbAdmin\Db\DbFacade::class);
60
                return new Lagdo\DbAdmin\Db\Facades\ImportFacade($dbFacade);
61
            },
62
            Lagdo\DbAdmin\Db\Facades\QueryFacade::class => function($di) {
63
                $dbFacade = $di->g(Lagdo\DbAdmin\Db\DbFacade::class);
64
                return new Lagdo\DbAdmin\Db\Facades\QueryFacade($dbFacade);
65
            },
66
            Lagdo\DbAdmin\Db\Facades\SelectFacade::class => function($di) {
67
                $dbFacade = $di->g(Lagdo\DbAdmin\Db\DbFacade::class);
68
                return new Lagdo\DbAdmin\Db\Facades\SelectFacade($dbFacade);
69
            },
70
            Lagdo\DbAdmin\Db\Facades\ServerFacade::class => function($di) {
71
                $dbFacade = $di->g(Lagdo\DbAdmin\Db\DbFacade::class);
72
                return new Lagdo\DbAdmin\Db\Facades\ServerFacade($dbFacade, $dbFacade->getServerOptions());
73
            },
74
            Lagdo\DbAdmin\Db\Facades\TableFacade::class => function($di) {
75
                $dbFacade = $di->g(Lagdo\DbAdmin\Db\DbFacade::class);
76
                return new Lagdo\DbAdmin\Db\Facades\TableFacade($dbFacade);
77
            },
78
            Lagdo\DbAdmin\Db\Facades\UserFacade::class => function($di) {
79
                $dbFacade = $di->g(Lagdo\DbAdmin\Db\DbFacade::class);
80
                return new Lagdo\DbAdmin\Db\Facades\UserFacade($dbFacade);
81
            },
82
            Lagdo\DbAdmin\Db\Facades\ViewFacade::class => function($di) {
83
                $dbFacade = $di->g(Lagdo\DbAdmin\Db\DbFacade::class);
84
                return new Lagdo\DbAdmin\Db\Facades\ViewFacade($dbFacade);
85
            },
86
        ],
87
        'auto' => [
88
            // The translator
89
            Lagdo\DbAdmin\Translator::class,
90
            // The string manipulation class
91
            Lagdo\DbAdmin\Driver\Utils\Str::class,
92
            // The user input
93
            Lagdo\DbAdmin\Driver\Utils\Input::class,
94
            // The query history
95
            Lagdo\DbAdmin\Driver\Utils\History::class,
96
            // The utils class
97
            Lagdo\DbAdmin\Driver\Utils\Utils::class,
98
            // The facade to the database features
99
            Lagdo\DbAdmin\Db\DbFacade::class,
100
            // The db classes
101
            Lagdo\DbAdmin\Admin\Admin::class,
102
            // The template builders
103
            Lagdo\DbAdmin\Ui\UiBuilder::class,
104
            Lagdo\DbAdmin\Ui\MenuBuilder::class,
105
            Lagdo\DbAdmin\Ui\PageBuilder::class,
106
        ],
107
        'alias' => [
108
            // The translator
109
            Lagdo\DbAdmin\Driver\Utils\TranslatorInterface::class => Lagdo\DbAdmin\Translator::class,
110
        ],
111
    ],
112
    'exceptions' => [
113
        DbException::class => function(DbException $dbException) {
114
            $response = jaxon()->getResponse();
115
            $response->dialog->warning($dbException->getMessage());
0 ignored issues
show
The method warning() does not exist on Jaxon\Plugin\ResponsePluginInterface. It seems like you code against a sub-type of Jaxon\Plugin\ResponsePluginInterface such as Jaxon\Plugin\Response\Dialog\DialogPlugin. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

115
            $response->dialog->/** @scrutinizer ignore-call */ 
116
                               warning($dbException->getMessage());
Loading history...
The method warning() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

115
            $response->dialog->/** @scrutinizer ignore-call */ 
116
                               warning($dbException->getMessage());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
116
            return $response;
117
        },
118
    ],
119
];
120