CATEGORY: Gii

Gii- Model generator

Model generator

  • It generate Model for you.
  • For instance, You want to create a model for the table cnd
    • In the Table Name field, enter cnd.
    • In the Model Class field, enter Cnd. (Auto Filled)
    • Press the Preview button.
      • This will show us the new code file to be generated.
    • Now press the Generate button.
      • A new file named Cnd.phpwill be generated under protected/models.
  • Through this Cnd model class, you can access the underlying cnd table in an object-oriented fashion.

Configuring Gii

Configuring Gii

  • Open the application configuration file : /testApplication/protected/config/main.php
  • Add/uncomment this

returnarray(

……

‘import’=>array(

‘application.models.*’,

‘application.components.*’,

),

‘modules’=>array(

‘gii’=>array(

‘class’=>’system.gii.GiiModule’,

‘password’=>’pick up a password here’,

),
),

);
add your password in place of ‘pick up a password here’.

  • Open this URL: http://localhost/testApplication/index.php?r=gii.
  • It will prompt you for password; enter the one that you just entered in above configuration file.
    • It displays the following options :
        • Controller generator
        • Model generator
        • Crude generator
        • Module generator

      gii

There are no more results.