John Davidson

php - Yii2 - Getting unknown property: yii\console\Application::user

0 comments
Message:


I am trying to run a console controller from the terminal, but i am getting this errors every time



Error: Getting unknown property: yii\console\Application::user


here is the controller



class TestController extends \yii\console\Controller {

public function actionIndex() {
echo 'this is console action';
} }


and this is the concole config



return [
'id' => 'app-console',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'console\controllers',
'modules' => [],
'components' => [
'log' => [
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
],
'params' => $params];


I tried running it using these commands with no luck



php yii test/index
php yii test
php ./yii test


can anyone help please?



My Answer:
'console',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'app\commands',
'components' => [
'db' => require(__DIR__ . '/db.php'),
],
];

Rate this post

3 of 5 based on 7015 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us