Home » » Cakephp Interview Questions and Answers

Cakephp Interview Questions and Answers

Written By 1 on Sunday, April 21, 2013 | 1:34 AM

Question: What is  cakephp?.
Answer: 
CakephpCakePHP  is a free, open-source, rapid development framework for PHP. It's a foundational structure for programmers to create web applications. There is number of in built component like Ajax, RequestHandler, Session etc



Question: What are are drawbacks of cakephp.
Answer : The learning curve, and it loads full application before it starts your task. Its not recommended for small projects because of its resource heavy structure.

Question : What is MVC (model, view, and controller) in cakephp?
Answer : Model–view–controller (MVC) is an architectural pattern used in software engineering.
Model: Databases function exist in the model
View: Design parts written here
Controller: Business Login


Question : What is the name of Cakephp database configuration file name and its location?
Answer: Default file name is database.php.default.
Its located in "/app/config/database.php.defaut"


Question : What are component, helper and why are they used?
Answer: A component is an independent piece of code written for specific task that can be used(Eg Email, Ajax, RequestHandler and Session).
A helper is used for helping cakephp in rendering the data to be shown to user with views(Eg Form, HTML etc).


Question : What are commonly used components of cakephp?
Answer: Following are some components which is used in cakephp.

  • Security
  • Sessions
  • ACL(Access control lists)
  • Auth(Authentication)
  • Emails
  • Cookies
  • RequestHandling
  • MVC architecture
  • Built-in validations
  • Caching
  • scaffolding


Question: What is HABTM.
Answer: Full form of Has And Belongs To Many.
It is a kind of associations that can be defined in models for retrieving associated data across different entities.
For Example
A product have one or more tags, and a tag may belongs to one or more product.


HABTM Relation

/**
* Post Model
*
* @property Tag $Tag
*/
class Post extends AppModel {

/**
* Display field
*
* @var string
*/
public $displayField = 'name';

/**
* Validation rules
*
* @var array
*/
public $validate = array( );

/**
* hasAndBelongsToMany associations
*
* @var array
*/
public $hasAndBelongsToMany = array(
'Tag' => array(
'className' => 'Tag',
'joinTable' => 'posts_tags',
'foreignKey' => 'post_id',
'associationForeignKey' => 'tag_id',
'unique' => 'keepExisting',
)
);


}
Question : What is default function and default controller of cakephp which is called automatically?
Answer: Default controller is indexController.php and Default function is index.


Question : How cakephp URL looks in address bar
Answer: http://example.com/controller/action/param1/param2/param3

Question : Why cakephp have two vendor folder?
Answer: There is two vendor folder, one folder in root and another is in "app" folder




    Question : List some database related functions in cakephp.
    Answer: find, findAll , findAllBy , findBy , findNeighbours and query.


    Question : List some of the features in Cakephp
    Answer: Following are some feature of Cakephp.

    Question : list some of the features in Cakephp
    Answer: Following are some feature of Cakephp.
    MVC architecture
    Built-in validations
    Caching
    scaffolding




    0 Comment:

    Post a Comment