Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

StorageActiveRecord cannot find $activeRecordClass at bootstrap #23

Closed
dbd5 opened this issue Jan 16, 2020 · 1 comment
Closed

StorageActiveRecord cannot find $activeRecordClass at bootstrap #23

dbd5 opened this issue Jan 16, 2020 · 1 comment
Labels

Comments

@dbd5
Copy link

dbd5 commented Jan 16, 2020

What steps will reproduce the problem?

Add configManager to application bootstrap and setup configManager with a storage configuration in the components section

What is the expected result?

The idea is to update certain UI settings in the app from a table lookup based on filter parameters that can only be known at runtime;

What do you get instead?

I get the following error;

Error: Class 'common\models\MetaConfig' not found in /var/www/server/vendor/yii2tech/config/src/StorageActiveRecord.php:103
Stack trace:
#0 /var/www/server/vendor/yii2tech/config/src/Manager.php(356): yii2tech\config\StorageActiveRecord->get()
#1 /var/www/server/vendor/yii2tech/config/src/Manager.php(169): yii2tech\config\Manager->restoreValues()
#2 /var/www/server/vendor/yiisoft/yii2/base/BaseObject.php(109): yii2tech\config\Manager->init()
#3 [internal function]: yii\base\BaseObject->__construct(Array)
#4 /var/www/server/vendor/yiisoft/yii2/di/Container.php(384): ReflectionClass->newInstanceArgs(Array)
#5 /var/www/server/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('yii2tech\config...', Array, Array)
#6 /var/www/server/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('yii2tech\config...', Array, Array)
#7 /var/www/server/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Array)
#8 /var/www/server/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get('MetaConfig...', true)
#9 /var/www/server/vendor/yiisoft/yii2/base/Application.php(313): yii\base\Module->get('MetaConfig...')
#10 /var/www/server/vendor/yiisoft/yii2/web/Application.php(69): yii\base\Application->bootstrap()
#11 /var/www/server/vendor/yiisoft/yii2/base/Application.php(273): yii\web\Application->bootstrap()
#12 /var/www/server/vendor/yiisoft/yii2/base/BaseObject.php(109): yii\base\Application->init()
#13 /var/www/server/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#14 /var/www/server/frontend/web/index.php(22): yii\base\Application->__construct(Array)
#15 {main}

Additional info

The complete configuration is as follows;

[
'bootstrap' => [
    'configManager',
    // ...
],
'components' => [
    'configManager' => [
        'class' => 'yii2tech\config\Manager',
        'autoRestoreValues' => true,
        'cacheId' => '__META__',
        'cacheDuration' => 3600,
        'storage' => [
            'class' => 'yii2tech\config\StorageActiveRecord',
            'activeRecordClass' => \common\models\MetaConfig::class,
            'idAttribute' => 'value_key',
            'valueAttribute' => 'value',
            'filter' => function () {
                return [
                    'host' => 'test.local'
                ];
            },
        ],
        'items' => [
            'appName' => [
                'path' => 'name',
                'label' => 'Application Name',
                'rules' => [
                ['required']
            ],
            ],
                'nullDisplay' => [
                    'path' => 'components.formatter.nullDisplay',
                    'label' => 'HTML representing not set value',
                    'rules' => [
                    ['required']
                ],
            ],
        ],
        ],
        ...
    ],
];
Q A
This Package Version 1.0.7
Yii Framework Version 2.0.28
PHP version 7.2.26
Operating system Ubuntu 18
@dbd5
Copy link
Author

dbd5 commented Jan 17, 2020

Resolved, sorry about the bother

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants