Skip to content
This repository has been archived by the owner on Mar 1, 2018. It is now read-only.
/ yii2-gii-command Public archive

❌ Running Yii2 Framework Code Generator Gii from command line

Notifications You must be signed in to change notification settings

dmstr/yii2-gii-command

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Giic2


NOTE! THIS EXTENSION IS OUTDATED AND WILL NOT BE MAINTAINED, FUNCTIONALITY IS AVAILABLE IN YII2-CORE SINCE 2.0.0-RC

Running Yii2 Framework Gii Code Generators from command line

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist dmstr/yii2-gii-command "*"

Setup

Make sure the Gii module is available in your console configuration.

$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = 'yii\gii\Module';

The extension will register a giic command alias in the application bootstrap process, if Gii is available.

Usage

Show available generators:

./yii help giic

Note: giic is NOT generating and overwriting code files unless you use the option --generate=1

Create a controller

./yii giic/controller --template=default --controller=my-first-giic-controller

Create a model

./yii giic/model --template=default --tableName=foo --modelClass=Foo

Run a giiant batch

./yii giiant-batch \
  --tables=actor,address,category,city,country,customer,film,film_actor,film_category,film_text,inventory,language,payment,rental,staff,store \
  --modelNamespace=app\\models \
  --crudControllerNamespace=app\\controllers\\crud --crudViewPath=@app/views/crud

The above command will create models and CRUDs with relations for all given table names using the giiant generators.

Known Limitations

Compatibility with Help command

./yii help giic/model

Will not show all available options, a workaround is to look at the generator attributes or run the command without any parameters and review the Attribute Errors.

$ ./yii giic/model
Loading generator 'model'...

Attribute Errors
----------------
template: A code template must be selected.
tableName: Table Name cannot be blank.
modelClass: Model Class cannot be blank if table name does not end with asterisk.

Links

Related Extensions

About

❌ Running Yii2 Framework Code Generator Gii from command line

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages