Skip to content

Instantly share code, notes, and snippets.

@jsivakumaran
Last active May 11, 2016 18:35
Show Gist options
  • Save jsivakumaran/9106b2a84858aa353d457e9c808e7da8 to your computer and use it in GitHub Desktop.
Save jsivakumaran/9106b2a84858aa353d457e9c808e7da8 to your computer and use it in GitHub Desktop.
Gii Generate Model and CRUD Templates
To Get to the Generator
xx.xx.xx.xx/frontend/web/gii
To Create a Model
1. Create a migration script in /console/migrations
2. ./yii migrate up
3. Head to /frontend/web/gii - click Model Generator - Table Name && Class Name are obvious - Namespace - common\models\ar
4. Click Preview - then if everything looks good - Click Generate.
To Create a CRUD
1. Create a Model
2. /frontend/web/gii - Click CRUD Generator -
A.Model Class - common\models\ar\Contract
B.Search Model Class - common\models\ar\queries\ContractQuery
C.Controller Class - frontend\controllers\ContractController
D.View Path - ../views/contract
3. Preview - then if everything looks right - Click Generate.
4. Then Go in and edit the Generated Code to Ensure that it looks good in the website.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment