2017 © Pedro Peláez
 

yii2-extension yii2-gii-command

Running Yii2 Framework Code Generator Gii from command line

image

dmstr/yii2-gii-command

Running Yii2 Framework Code Generator Gii from command line

  • Wednesday, October 1, 2014
  • by schmunk
  • Repository
  • 0 Watchers
  • 0 Stars
  • 2,881 Installations
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

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, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

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

Setup

Make sure the Gii module is available in your console configuration., (*4)

$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., (*5)

Usage

Show available generators:, (*6)

./yii help giic

Note: giic is NOT generating and overwriting code files unless you use the option --generate=1, (*7)

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., (*8)

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., (*9)

$ ./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.

The Versions

01/10 2014

dev-master

9999999-dev

Running Yii2 Framework Code Generator Gii from command line

  Sources   Download

BSD-3-Clause

extension yii2 gii command line code generator shell batch