Advance CakePHP Interview Questions

Here is the list of advance Cakephp interview questions that every Cakephp developer should know before going for interview. And here I am just giving overview of answers so for complete answers you should go through respective documentation.

Question – How many different type of Cache CakePHP Supports?

  1. FileCache
  2. ApcCache
  3. Wincache
  4. XcacheEngine
  5. MemcacheEngine
  6. RedisEngine

FileEngine is always the default cache engine

For more information on caching go to Cake Caching Docs

Question – What are Hooks in CakePHP  ?

Hooks are the functions that we can call before and after doing any task in Models ( database related ). Like after finding data, before saving data etc.

e.g beforeSave(), afterSave(), beforeFind(), afterFind() etc.

For more information on Hooks go to Cake Hook Docs

Question – How internally CakePHP work with database ?

This question shows how much you know about internal structure of CakePHP and also your PHP knowledge.

Question – How associations work in CakePHP ?

For information on Associations see asknsay.com CakePhp Association With Example

Question – Explain Validation Model in CakePHP .

CakePHP provide a very powerful validation model so that you can easily manage your data validation. CakePHP Model compoment is responsible for data validation as it deals with database.To do validation in CakePHP you just need to declare a $validate array in your model class for required fields. Below is small example.

For more information on Validation go to Cake Validation Docs

Question – What is a Behavior in CakePHP ?

Behaviors are used with CakePHP Model component to seperate and reuse the logic. They act like ” Component in Controller ” so that you can reuse your logic and no need to have same logic in different models.
e.g FileUpload behavior can be use to handle file uploaing logic that can integrate with any number of model classes.
For more information on Behavior go to Cake Behavior Docs

Question – What is difference between beforeRender and beforeFilter function ?

beforeFilter function is executed before every action in the controller ( i.e when request comes to controller ). You can use this fuction for authentication.
beforeRender function is executed before the view is rendered ( i.e when request goes to view from controller ).

Question – How Routing work in CakePHP ?

For information on Routing see asknsay.com Cake PHP Url Rewriting

Some basic questions you can find everywhere are listed below.

  • What is directory structure of CakePHP ?
  • MVC in CakePHP ?
  • Where are the configuration and database files?
  • How to use ajax in CakePHP ?
  • Which controller component is use for ajax request.

  • okoktatabyebye

    Great Work.. Some changes needed as follows

    beforeFilter() – This function is executed before every action in the controller. It’s a handy place to check for an active session or inspect user permissions.
    beforeRender() – Called after controller action logic, but before the view is rendered. This callback is not used often, but may be needed if you are calling render() manually before the end of a given action.

  • Kevin Smith

    more questions to see webetutorial