Académique Documents
Professionnel Documents
Culture Documents
http://www.yiiframework.com/doc-2.0/guide-start-installation.html
10. How to set default controller on Yii Project?
Answer: We can set on configuration file (protected/config/main.php).
array(
'name'=>'Yii Framework',
'defaultController'=>'site',
)
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-1/)
11. How to access application components on Yii Project? --> ganti jawaban pake yg unt
yii2, lihat yg warna biru
Answer: To access an application component, use Yii::app()->ComponentID, where
ComponentID refers to the ID of the component (e.g. Yii::app()->cache).
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-1/)
Yii::$app->ComponentID lihat di buku Yii2Book
12. How to get current controller id in Yii? --> ini Yii1
Answer: $controllerid = Yii::app()->controller->id;
$this->context->action->id
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-1/)
13. How to get current action id in Yii? --> ini Yii1
Answer: $actionid = Yii::app()->controller->action->id; $this>context->action->id
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-1/)
14. What are the type of models available in Yii framework?
Answer: Yii implements two kinds of models: Form models and active records. They
both extend from the same base class,CModel. Model
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-2/)
15. How to use widget on Yii framework?
Answer: To use a widget, do as follows in a view script:
beginWidget('path.to.WidgetClass'); ?>
or
widget('path.to.WidgetClass'); ?>
yii\base\Widget::widget()
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-3/)
16. What is the first function that gets loaded from a controller?
Answer: Index function. i.e) actionIndex().
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-3/)
17. List out some database related functions in Yii?
Answer: Query, find, findAll , findByPk , find By
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-4/)
18. How to include a javascript menu through a site?
Answer: We can include by adding the javascript files in webroot and then call them
in default views if they are needed everywhere or in the related views.
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-4/)
19. Who was the developer of the Yii and when was it build?
Answer: The developer of the Yii is Yii Software LLC. It was started in the year 2008
in December 3, with the version of 1.0 and continued to 1.1.13. in PHP language.
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-4/)
20. How does Yii Compare with Other Frameworks?
Answer: Comparatively to most of PHP frameworks, Yii is a MVC framework. Yii
bests PHP frameworks for its efficient, feature-rich and clearly-documented. Yii is
designed to be fit for serious Web application development. It is neither a
consequence of some project nor a corporation of third-party work.
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-4/)
21. How do we extend Yii?
Answer: Extending Yii is a common action during web development. Like when we
write a new controller, we extend Yii by inheriting its CController Controller class;
when we write a new widget, we will extend CWidget Widget or an existing class.
If the code is designed to be reused by third-party then we call it an extension.
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-4/)
22. What is a Yiibase?
Answer: YiiBase is a helper class that serves functionalities of common framework.
We should not use YiiBase directly. Instead, have to use its child class where we can
customize the methods of YiiBase
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-4/)
23. How to generate CRUD code?
Answer: After creating a model class file, we shall generate the code that implements
the CRUD operations for user data. We choose the Crud Generator in Gii. In the
model class field, we enter User. In the Controller ID field, we enter user in lower
case. Then press the preview button followed by the Generate button. Now we are
done with the CRUD code generation.
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-4/)