What is CRUD
CRUD stands for Create, Read, Update, and Delete, representing the four common tasks taken with data on most Web sites. CRUD Generator generates a controller and views that implement CRUD operations for the specified data model.
What is Gii?
Gii is web-based code generator.
With Gii we can quickly generate models, forms, modules, CRUD, etc..
How to use Gii
In our environment we can use Gii web-based interface by going to this address:
http://localhost/project-folder/backend/web/index.php?r=gii
You should see:
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 with 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 specified model class.
Module Generator
This generator helps you to generate the skeleton code needed by a Yii module.
Extension Generator
This generator helps you to generate the files needed by a Yii extension.
How to use Gii and Generating CRUD code
We can generate CRUD code directly in the Gii code generator. To go to CRUD generator click on the “CRUD Generator” button or go to this address:
http://localhost/project-folder/backend/web/index.php?r=gii%2Fdefault%2Fview&id=crud
There are several form fields which we have to fill:
Model class - This is the ActiveRecord class associated with the table that CRUD will be built upon.
Search Model Class - This is the name of the search model class to be generated.
Controller Class - This is the name of the controller class to be generated.
View Path - Specify the directory for storing the view scripts for the controller.
Widget Used in Index Page - This is the widget type to be used in the index page to display list of the models.
Note : Please add your valuable comments and add your tutorial links in comments column for helps to others..
No comments:
Post a Comment