I’ve worked in a Yii2 environment before, but this is my first time starting a project with Yii2.
I created a new project with the advanced template and everything seems to be working properly. However, I’m having issues getting gii to work from the command line.
I ran
php yii gii/model --modelClass=Client --tableName=client
and it created the model correctly, however it created it in the console/models folders. Ideally I would like to create it in common\models, however attempting to create the model with --modelClass=common\models\Client simply asks if I want to create the model "commonmodelsClient".
Beyond that, I want to create a CRUD controller with
php yii gii/crud --controllerClass=ClientController --modelClass=Client
but I just get the errors:
- modelClass: Class 'Client' does not exist or has syntax error.
- controllerClass: The class name must contain fully qualified namespace name.
I’ve tried adding namespaces at varying points like --modelClass=app\models\Client, but again get the “appmodelsClient” issue. Likewise if I try to say --controllerClass=app\controllers\ClientController I get an error about the controller needing to start with a capital letter.
I’m sure this is just me not understanding what formatting the commands expect, but I wasn’t able to find any specifics in the documentation other than the example for
php yii gii/model --tableName=city --modelClass=City