Bookcafe

Saturday, March 25, 2017

Yii2 Application In The Making (Using Gii on Yii2)

I am trying to develop Yii application using the latest Yii2 Framework using the same ways as application that i developed using Yii 1.1 Framework sometimes ago. Please refer HERE for background information.

I am using Gii to help me to generate codes for my Yii2 application

Gii is already enabled by default in Yii2 and to make sure its happens,  please check /web/index.php to verify.



Go this url http://my_site_FQDN/web/index.php?r=gii to start using the Gii




I wanted to use my existing MySql table to apply Gii, in this case as similar like before Alumnidata2

Click Model Generator. Fill out the Table Name as in this case alumnidata2 and the Model Class Alumnidata2 and then click Preview. Let the other fields at its default values




The outcome will be like this


If you satisfied with the values, click Generate and the result will be like the this:

Next, I would like to use the Create, Read, Update and Delete function or know as CRUD on my alumnidata2 table.

Click on the CRUD Generator and fill in the blanks for the relevant values as below :



Click Preview to get the following result :


If all values are acceptable, click Generate to get the following :

To find out the final result, please go to the url


 http://my_site_FQDN/web/index.php?r=alumnidata2%2Findex


and you should get the following final result



Now you can manipulate the data in the Alumnidata2 table.

Click Create Alumnidata2 to create data in Alumnidata2 table.

To delete or edit data just click on the following icons :


Now, maybe you are already notice the differences using Gii on version 1.1 and version 2. Please drop some comments.


No comments:

Post a Comment