Answer the question
In order to leave comments, you need to log in
Yii2 how to connect console commands in a module?
Hello!
1. I placed the console commands in the module backend\modules\event\commands
2. I connected the commands in the module:
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (Yii::$app instanceof \yii\console\Application) {
$this->controllerNamespace = 'backend\modules\event\commands';
}
}
console
, instead 'backend\modules\event\commands'
$application = new yii\console\Application($config);
$exitCode = $application->run();
exit($exitCode);
and contact him? Tell me please!
Answer the question
In order to leave comments, you need to log in
Good morning.
If you open the yii file, you will see that it is almost identical to the index file in the web directory.
This means that you can move it to the right place, change the paths to the configuration files and run it)))
Here is an article that will help you.
Article for yii1, but I think you will understand the idea.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question