Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
3fba6dc3
Commit
3fba6dc3
authored
Dec 12, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated gii docs
parent
ed0e76b7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
gii.md
docs/guide/gii.md
+12
-9
main.php
extensions/yii/gii/views/layouts/main.php
+1
-1
No files found.
docs/guide/gii.md
View file @
3fba6dc3
...
...
@@ -4,6 +4,7 @@ The Gii code generation tool
Yii2 includes a handy tool that allows rapid prototyping by generating commonly used code snippets
as well as complete CRUD controllers.
Installing and configuring
--------------------------
...
...
@@ -58,14 +59,14 @@ When you open Gii you first see the entry page that lets you choose a generator.
By default there are the following generators available:
-
*
Model Generator
*
- This generator generates an ActiveRecord class for the specified database table.
-
*
CRUD Generator
*
- This generator generates a controller and views that implement CRUD (Create, Read, Update, Delete)
-
*
*Model Generator*
*
- This generator generates an ActiveRecord class for the specified database table.
-
*
*CRUD Generator*
*
- This generator generates a controller and views that implement CRUD (Create, Read, Update, Delete)
operations for the specified data model.
-
*
Controller Generator
*
- This generator helps you to quickly generate a new controller class, one or several
-
*
*Controller Generator*
*
- This generator helps you to quickly generate a new controller class, one or several
controller actions and their corresponding views.
-
*
Form Generator
*
- This generator generates a view script file that displays a form to collect input for the
-
*
*Form Generator*
*
- This generator generates a view script file that displays a form to collect input for the
specified model class.
-
*
Module Generator
*
- This generator helps you to generate the skeleton code needed by a Yii module.
-
*
*Module Generator*
*
- This generator helps you to generate the skeleton code needed by a Yii module.
After choosing a generator by clicking on the "Start" button you will see a form that allows you to configure the
parameters of the generator. Fill out the form according to your needs and press the "Preview" button to get a
...
...
@@ -78,6 +79,11 @@ Clicking on the file name you can view a preview of the code that will be genera
When the file already exists, gii also provides a diff view that shows what is different between the code that exists
and the one that will be generated. In this case you can also choose which files should be overridden and which not.
> Tip: When using the Model Generator to update models after database change, you can copy the code from gii preview
and merge the changes with your own code. You can use IDE features like PHPStorms
[
compare with clipboard
](
http://www.jetbrains.com/phpstorm/webhelp/comparing-files.html
)
for this,
which allows you to merge in relevant changes and leave out others that may revert your own code.
After you have reviewed the code and selected the files to be generated you can click the "Generate" button to create
the files. If all went fine you are done. When you see errors that gii is not able to generate the files you have to
adjust directory permissions so that your webserver is able to write to the directories and create the files.
...
...
@@ -88,10 +94,6 @@ adjust directory permissions so that your webserver is able to write to the dire
some parts of it. This is not how it is ment to be used. Code generated by gii may be incomplete or incorrect
and has to be changed to fit your needs before you can use it.
> Tip: To update models after database change you can copy the code from gii preview and merge the changes with
your own code. You can use IDE features like PHPStorms "compare with clipboard" for this which allows you to
merge in relevant changes and leave out others that may revert your own code.
Creating your own templates
---------------------------
...
...
@@ -101,6 +103,7 @@ By default gii only provides one template but you can create your own templates
TBD
Creating your own generators
----------------------------
...
...
extensions/yii/gii/views/layouts/main.php
View file @
3fba6dc3
...
...
@@ -29,7 +29,7 @@ echo Nav::widget([
'options'
=>
[
'class'
=>
'nav navbar-nav navbar-right'
],
'items'
=>
[
[
'label'
=>
'Home'
,
'url'
=>
[
'default/index'
]],
[
'label'
=>
'Help'
,
'url'
=>
'http
://www.yiiframework.com/doc/guide/topics.gii
'
],
[
'label'
=>
'Help'
,
'url'
=>
'http
s://github.com/yiisoft/yii2/blob/master/docs/guide/gii.md
'
],
[
'label'
=>
'Application'
,
'url'
=>
Yii
::
$app
->
homeUrl
],
],
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment