Vous êtes sur la page 1sur 4

INTERVIEW TEST

DEVELOPMENT WEBSITE APP USING YII2 FRAMEWORK


1. What is Yii Framework? cari yg lain
Answer: Yii is a high-performance component-based PHP framework best for Web
2.0 development.
(ORI: http://amodi007.blogspot.com/p/yii-basic-interview-question_2.html)
2. What is the first file that gets loaded when you run a application using Yii?
Answer: index.php
(ORI: http://www.sanfoundry.com/php-questions-answers-advanced-object-orientedphp/)
3. What is the first function that gets loaded from a controller?
Answer: index
(ORI: http://amodi007.blogspot.com/p/yii-basic-interview-question_2.html)
4. How can we use ajax in Yii?
Answer: by calling ajax helper and then using it in controller for rendering.
(ORI: http://amodi007.blogspot.com/p/yii-basic-interview-question_2.html)
5. If you have to validate a registrations module for a user, what all can be possible
ways, which one is the best?
Answer: can be done on submission in controller, or using javascript/ajax while user
is still filling the data. Second option is better.
(ORI: http://amodi007.blogspot.com/p/yii-basic-interview-question_2.html)
6. Can you list some database related functions in Yii?
Answer: find, findAll , findByPk , find By ,query.
(ORI: http://amodi007.blogspot.com/p/yii-basic-interview-question_2.html)
7. How can you include a javascript menu throught the site?
Answer: By adding the javascript files in webroot and call them in default views if
needed everywhere or just in the related views.
(ORI: http://amodi007.blogspot.com/p/yii-basic-interview-question_2.html)
8. How to install Yii framework?
Answer: Installation of Yii mainly involves the following two steps:
a. Download Yii Framework from yiiframework.com.

b. Unpack the Yii release file to a Web-accessible directory..


(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-1/)
9. What command used to create new Yii project? ? --> ganti jawaban pake yg unt yii2,
lihat yg warna biru
Answer: % YiiRoot/framework/yiic webapp WebRoot/testdrive.
(ORI: http://tut2learn.com/2014/03/yii-interview-questions-and-answers-part-1/)
composer create-project --prefer-dist yiisoft/yii2-app-basic basic

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',
)

'defaultRoute' => 'user/index'

(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'); ?>

...body content that may be captured by the widget...


endWidget(); ?>

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/)

Vous aimerez peut-être aussi