1. Question:How to enable gii in yii? 

    Answer
    To enablel gii in yii we should edit ‘modules’ after entering yii\protected\config\main.php . Snippet are showing belows:
    
    'modules'=>array(
    		'gii'=>array(
    			'class'=>'system.gii.GiiModule',
    			'password'=>’type password’,
    			'ipFilters'=>array('127.0.0.1','::1'),
    		),






    1. Report
  2. Question:How to enable url manager in yii? 

    Answer
    url manager remains in yii\protected\config\main.php. We can enable after un commenting ‘urlManager’ and the codes will show like:
    'urlManager'=>array(
    			'urlFormat'=>'path',
    			'showScriptName'=>false,
    			'rules'=>array(
    				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
    				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
    				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
    			),
    		),






    1. Report
  3. Question:Discuss the controller and its method convention in yii. 

    Answer
    : A controller is an instance of CController or of a class that extends CController. It is created by the application object when the user requests it.
    
    controller convention:  The ControllerID in CamelCase suffixed with ‘Controller’ ex. SiteController, where Site is the ControllerID.
    
    Method convention:  camelCase with first letter lowercase like getProperty(),actionCreate().Ex:
    public function actionCreate()
                { 
    block of statement
                 }






    1. Report
  4. Question:What is component in yii? 

    Answer
    Yii applications are built upon components which are objects written to a specification. A component is an instance of CComponent or its derived class. Using a component mainly involves accessing its properties and raising/handling its events.  
    Example:  CDbConnection this component provides a database connection.
    [page#25(pdf),  http://www.yiiframework.com/doc/guide/1.1/en/basics.component]






    1. Report
  5. Question:How many ways you can work with database in yii? Discuss. 

    Answer
    Yii has several types of database support those are 
     a. SQL via DAO
     b. query builder
     c. Active Record






    1. Report
Copyright © 2025. Powered by Intellect Software Ltd