bedezign/yii2-audit

Db panel extends \yii\debug\panels\DbPanel,But when I dont have connection which named 'db',It will not work.

Nash-x9 opened this issue · 1 comments

Db panel extends \yii\debug\panels\DbPanel,But when I dont have connection which named 'db',It will not work.

My config like this:

<?php
return [
    'components' => [
        'read_data'=> [
             'class' => 'yii\db\Connection',
             //some other config
        ],
        'write_data'=> [
             'class' => 'yii\db\Connection',
            //some other config
        ],
    ],
];

That I don't have any Connection called 'db'.So it will throw these:
Invalid Configuration – yii\base\InvalidConfigException
Unknown component ID: db

The debug DbPanel assumes that a db connection is present.
Audit's DbPanel does nothing in that matter as it just overrides that class's logging functionality.

So to make this work you'll have to configure the panel with a db value that points to the correct connection.
Basically you can just set the 'db' => 'connection name' in your audit panel configuration and it will be used.
The Module Configuration should be able to help you further..