yii2 gii command line template

Hello,

On Yii2 I’m using gii to generate models and cruds with my own models and it works fine. Now I want to use gii on the command line but I get the message :

Code not generated. Please fix the following errors:

  • template: Unable to find the required code template file ‘model.php’.

The command line I entered is :

yii gii/model --ns:common\models --tableName=mki_project --modelClass=MkiProject --template:myModel

I setup main-local.php file in console :

$config[‘modules’][‘gii’] = [

'class' => 'yii\gii\Module',      


'generators' => [


    'model' => [


        'class' => 'console\myTemplates\model\Generator',


        'templates' => [


            'myModel' => '@app/myTemplates/model/mymodel',


        ]


    ],


    'crud' => [


        'class' => 'console\myTemplates\crud\Generator',


        'templates' => [


            'myCrud' => '@app/myTemplates/crud/mycrud',


        ]


    ]


],

];

Any help would be nice !

1 Like