1. Question:What is Yii framework? 

    Answer
    Yii is a very flexible and high-performance application development framework written in PHP. It helps building web applications, from small to large-scale enterprise applications. The framework name stands for Yes It Is (Yii).          Page: 5

    1. Report
  2. Question:What are the features of yii framework? 

    Answer
    Features fo Yii are : 
    i. Model-View-Controller (MVC) design pattern
    ii. Database Access Objects (DAO), Query Builder, Active Record, DB Migration
    iii. Form input and validation
    iv. AJAX-enabled widgets
    v. Unit and functionality testing
    vi. Friendly with third-party code

    1. Report
  3. Question:What is MVC?/ Explain about model, view, controller? 

    Answer
    : Elaboration of MVC  is Model View Controller. It is a pattern for building application. The Model represents the application core (for instance a list of database records). The View displays the data (the database records) and The Controller is the business logic.

    1. Report
  4. Question:What is the first function that gets loaded from a controller? 

    Answer
    The first function that gets loaded from a controller is index(). 
    example:
    Public  function actionIndex()
    {
     /* write code here*/
    }

    1. Report
  5. Question:How to connect to the database in YII? 

    Answer
    To connect a database, you have  to edit the database .php file which is at yii\protected\config\database.php:
    
    <?php
    	'connectionString' => 'mysql:host=localhost;dbname=yii116',
    	'emulatePrepare' => true,
    	'username' => 'root',
    	'password' => '',
    	'charset' => 'utf8',	
    );

    1. Report
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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 © 2024. Powered by Intellect Software Ltd