Generate a controller through console

Hi there! :)

Guys, I’m trying to generate few models and controllers through console. Model was generated fine, but I can’t generate a controller properly. See a screen below:

6667

1.png

I found the check-pattern in https://github.com/yiisoft/yii2-gii/blob/master/generators/controller/Generator.php#L7 and tried check out it on external regex service like - https://regex101.com/ using my controller name and path "app\controllers\TestController":

6668

2.png

What I did wrong ? :)

Good Morning,

Easy.

Just don’t use spaces in this command.

Wrong:




yii gii/controller --controllerClass = app\controllers\TestController

Running 'Controller Generator'...


Code not generated. Please fix the following errors:


 - controllerClass: Only word characters and backslashes are allowed, and the class name must end with "Controller".



Correct:




yii gii/controller --controllerClass=app\controllers\TestController


Running 'Controller Generator'...


The following files will be generated:

        [new] controllers\TestController.php

        [new] views\test\index.php


Ready to generate the selected files? (yes|no) [yes]:y



Regards

Yes, it is! :) Thx MetaCrawler !