Top Interview Questions and Answers

Top Interview Questions and Answers
Interview Sortout

Browsing "Older Posts"

CakePHP Interview Questions and Answers

By Dhananjay yadav → July 1, 2018

What is CakePHP ?
CakePHP is an open-source free web framework based on MVC pattern and written in PHP scripting Language for rapid web development.

What is MVC in CakePHP?
Model view controller (MVC) is an architectural pattern used in software engineering.
Model: Handle database related functionality, manipulating database related query like add, edit , delete.
View: Design parts written here (HTML+PHP)
Controller: Business Logic goes here

What are controllers?
A controller is used to manage the logic for a part of your application. Most commonly, controllers are used to manage the logic for a single model. Controllers can include any number of methods which are usually referred to as actions. Actions are controller methods used to display views. An action is a single method of a controller.


List some features of CakePHP framework ?
Top features of CakePHP framework
1-MVC Architecture
2-Zero configuration
3-Inbuilt validation
4-ACL Functionality and Security
5-CRUD scaffolding
6-Easily extendable with plug-ins
7-Quick and flexible


What are Hooks in CakePHP?
CakePHP hooks are callback functions that are called before or after a model operation and defined in models.
List of some Hooks functions provided by CakePHP.
1-beforeFind
2-afterFind
3-beforeValidate
4-afterValidate
5-beforeSave
6-afterSave
7-beforeDelete
8-afterDelete
9-onError


What is default function for a controller?
function index() is default function in controller.

What is a Element?
Element in cakephp are smaller and reusable bits of view code. Elements are usually rendered inside views.

What Is Scaffolding In Cakephp?
Scaffolding is a technical way that allows a developer to define and create a basic application that can create, retrieve, update and delete objects.

How To Get Current URL In CakePHP?
Simple using the following bit of code:
 
  $this->here;
 

How can you make urls search engine friendly while using cakephp?
It’s an automatic task that is done by cakephp.

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

What is Composer? How to create a CakePHP Project using Composer?
Composer is a tool for managing project dependencies. You can create a CakePHP project using Composer by running below commands on terminal.

 
  php composer.phar create-project --prefer-dist cakephp/app my_app_name
 

How To Get Controller Name In CakePHP Views?
Get controller name in CakePHP:
 
  $this->request->params['controller'];
 


What is a Helper in CakePHP?
Helpers in CakePHP are associated with Presentation layers of application.Helpers mainly contain presentational logic which is available to share between many views, elements, or layouts.


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


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


What is habtm?
Has And Belongs To Many is a kind of associations that can be defined in models for retrieving associated data across different entities.

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