Файл commands/FlagController.php:
namespace app\commands;
use yii;
use yii\console\Controller;
use yii\base\Component;
use app\components\flag\AbstractFlagService;
use app\components\flag\FlagService;
class FlagController extends Controller
{
public function actionCheck()
{
$flagService = \Yii::$app->get('flag-service');
if(Yii::$app->flag->run()) {
echo true;
}
}
}
}
Конфиг \config\console.php:
<?php use \yii\console\controllers\MigrateController;
$config = [
'id' => 'basic-console',
'controllerNamespace' => 'app\commands',
'components' => [
'flag' => [
'class' => 'app/components/flag/FlagService',
]
],
];
if (YII_ENV_DEV) {
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
];
}
return $config;
Вылетает ошибка:
Exception 'ReflectionException' with message 'Class app/components/flag/FlagService does not exist'.
Как правильно использовать компоненты в консольных приложениях?