Interview Questions

AJAX Interview Questions Android Interview Questions Angular 2 Interview Questions AngularJs Interview Questions Apache Presto Interview Questions Apache Tapestry Interview Questions Arduino Interview Questions ASP.NET MVC Interview Questions Aurelia Interview Questions AWS Interview Questions Blockchain Interview Questions Bootstrap Interview Questions C Interview Questions C Programming Coding Interview Questions C# Interview Questions Cakephp Interview Questions Cassandra Interview Questions CherryPy Interview Questions Clojure Interview Questions Cobol Interview Questions CodeIgniter interview Questions CoffeeScript Interview Questions Cordova Interview Questions CouchDB interview questions CSS Buttons Interview Questions CSS Interview Questions D Programming Language Interview Questions Dart Programming Language Interview Questions Data structure & Algorithm Interview Questions DB2 Interview Questions DBMS Interview Questions Django Interview Questions Docker Interview Questions DOJO Interview Questions Drupal Interview Questions Electron Interview Questions Elixir Interview Questions Erlang Interview Questions ES6 Interview Questions and Answers Euphoria Interview Questions ExpressJS Interview Questions Ext Js Interview Questions Firebase Interview Questions Flask Interview Questions Flex Interview Questions Fortran Interview Questions Foundation Interview Questions Framework7 Interview Questions FuelPHP Framework Interview Questions Go Programming Language Interview Questions Google Maps Interview Questions Groovy interview Questions GWT Interview Questions Hadoop Interview Questions Haskell Interview Questions Highcharts Interview Questions HTML Interview Questions HTTP Interview Questions Ionic Interview Questions iOS Interview Questions IoT Interview Questions Java BeanUtils Interview Questions Java Collections Interview Questions Java Interview Questions Java JDBC Interview Questions Java Multithreading Interview Questions Java OOPS Interview Questions Java Programming Coding Interview Questions Java Swing Interview Questions JavaFX Interview Questions JavaScript Interview Questions JCL (Job Control Language) Interview Questions Joomla Interview Questions jQuery Interview Questions js Interview Questions JSF Interview Questions JSP Interview Questions KnockoutJS Interview Questions Koa Interview Questions Laravel Interview Questions Less Interview Questions LISP Interview Questions Magento Interview Questions MariaDB Interview Questions Material Design Lite Interview Questions Materialize CSS Framework Interview Questions MathML Interview Questions MATLAB Interview Questions Meteor Interview Questions MongoDB interview Questions Moo Tools Interview Questions MySQL Interview Questions NodeJS Interview Questions OpenStack Interview Questions Oracle DBA Interview Questions Pascal Interview Questions Perl interview questions Phalcon Framework Interview Questions PhantomJS Interview Questions PhoneGap Interview Questions Php Interview Questions PL/SQL Interview Questions PostgreSQL Interview Questions PouchDB Interview Questions Prototype Interview Questions Pure CSS Interview Questions Python Interview Questions R programming Language Interview Questions React Native Interview Questions ReactJS Interview Questions RequireJs Interview Questions RESTful Web Services Interview Questions RPA Interview Questions Ruby on Rails Interview Questions SAS Interview Questions SASS Interview Questions Scala Interview Questions Sencha Touch Interview Questions SEO Interview Questions Servlet Interview Questions SQL Interview Questions SQL Server Interview Questions SQLite Interview Questions Struts Interview Questions SVG Interview Questions Swift Interview Questions Symfony PHP Framework Interview Questions T-SQL(Transact-SQL) Interview Questions TurboGears Framework Interview Questions TypeScript Interview Questions UiPath Interview Questions VB Script Interview Questions VBA Interview Questions WCF Interview Questions Web icon Interview Questions Web Service Interview Questions Web2py Framework Interview Questions WebGL Interview Questions Website Development Interview Questions WordPress Interview Questions Xamarin Interview Questions XHTML Interview Questions XML Interview Questions XSL Interview Questions Yii PHP Framework Interview Questions Zend Framework Interview Questions Network Architect Interview Questions

Top 31 CakePHP Interview Questions for 2021

1) What is CakePHP?

CakePHP is an open-source PHP framework. It is used to develop dynamic web applications. It helps to developers to work in a structured manner.

2) When cakePHP was developed?

CakePHP was developed by Michal Tatarynowicz a Polish programmer, in April 2005.

3) What are the system requirements for CakePHP?

System requirements for CakePHP are:

  • PHP 5.4.16 or greater
  • mbstring extension library
  • intl extension
  • MySQL (5.1.10 or greater).

4) What is MVC in CakePHP?

In CakePHP, Model View Controller (MVC) is an application design pattern. It consists of three components.

Model: Database functions exist in the model or a representation of database table.

View: Design parts written here or client user interface

Controller: It controls the client request and respond back.

5) Where does the database configuration file reside in CakePHP?

CakePHP stores configure file here: /app/config/database.php.default

6) What are the features of CakePHP?

CakePHP provides various significant features that are listed below:

  • MVC architecture
  • Built-in validations
  • Caching
  • Scaffolding
  • Auth & ACL
  • CSRF protection via Security Component etc.

7) How can we install CakePHP?

We can install CakePHP on windows operating system using following steps:

step1: Go to cakephp.org website and download the latest version of CakePHP.

step2: Cakephp comes in a .zip file,so unzip it.

step3: Extract the files in the localhost in the desired folder (for example:cakephp).

step4: Open the browser and run the URL localhost/cakephp

step5: Just follow the instructions display on the page.

8) What is scaffolding in CakePHP?

In CakePHP, scaffolding is a practical way that allows developer to define and create a basic application like:

  • Create
  • Retrieve
  • Update
  • delete objects

9) How do callback functions work in CakePHP?

In CakePHP, callback functions work like this:

/** In controller**/  

$userData = array();  

$this->User->InsertRecord($userData );  

/** In controller**/
/** In model **/  

function InsertRecord($userData){  

    $this->save($userData);  

}  

  

function beforeSave(){  

}  

  

function AfterSave(){  

}  

10) What are associations and its type in CakePHP?

In CakePHP, associations are used to access the data from database. There are various types of associations that shown in the given table:

RelationshipAssociation TypeExample in single Line
one to onehasOneA user has one profile.
one to ManyHas ManyA user can have multiple recipes.
Many to oneBelongs ToMany recipes belong to a user.
Many to ManyHas and belongs to manyRecipes have, and belong to, many ingredients.

11) What are the components of CakePHP?

CakePHP is a set of following components that make it awesome and popular.

  • Security
  • Sessions
  • Access control lists
  • Emails
  • Cookies
  • Authentication
  • Request handling
  • Scaffolding

12) What is a helper?

In CakePHP, helpers are associated with presentation layers of application. Helpers mainly contain presentation logic.

13) What are the commonly used helpers of cakephp?

Following are the various helpers available in cakephp.

  • FormHelper
  • HtmlHelper
  • JsHelper
  • CacheHelper
  • NumberHelper
  • Paginator
  • RSS
  • SessionHelper
  • TextHelper
  • TimeHelper etc.

14) How can we set layout in the controller in CakePHP?

We can set the layout in controller using following code:

var $layout = "layout_name";  

to overwrite for a specific action use below code in that action  

$this->layout ="layout_name";

15) How to include components in CakePHP controller?

Controller includes following component :

public $components = array('Emails', 'ImageUploader', 'Sms');

16) What is the use of $this->set() in CakePHP?

In CakePHP, the $this->set() method is used for creating a variable in the view file.

17) What are class name for email configuration transport?

There are various class names for email configuration transport:

  • Mail : It is used to send mail by using PHP mail function.
  • Smtp : Send using SMTP
  • Debug : Do not send the email, just return the result

18) How to create an email delivery profiles?

We can create an email delivery profile by using following command:

'Email' => [  

   'default' => [  

      'transport' => 'default',  

      'from' => 'you@localhost',  

   ],  

],

19) How to change the structure of URL in application, without modify the whole code?

The following code is used to change the structure of URL in an application.

url( string|array|null $url null , boolean $full false )

20) What are the types of event functions in Cake PHP?

There are various types of events functions in Cake PHP:

Helper::beforeRender(Event $event, $viewFile)

Helper::beforeRenderFile(Event $event, $viewFile)

Helper::afterRender(Event $event, $viewFile)

Helper::afterLayout(Event $event, $layoutFile) etc.

21) What is authentication and its type in Cake PHP?

In Cake PHP, authentication is the process of identify the correct user.

The following authentication types are:

  • FormAuthenticate
  • BasicAuthenticate
  • DigestAuthenticate

22) What are the various logging levels in CakePHP?

In CakePHP, there is several of logging level in CakePHP.

Logging levelDescription
EmergencySystem is unusable.
AlertAction must be taken immediately.
CriticalCritical conditions
ErrorError conditions
WarningWarning conditions
NoticeNormal but significant condition

23) What is the use of session in CakePHP?

In CakePHP, the session is used to manage unique users across requests and stores data.

24) What is the method to write Cookies in CakePHP?

In CakePHP, write() method is used to write Cookies.

25) How can we encrypt and decrypt data in CakePHP?

In CakePHP, we can encrypt and decrypt data by using security library methods.

Syntax:

static Cake\Utility\Security::hash($string, $type = NULL, $salt = false)

26) How can we create validator in the controller?

We can create validator in controller by using given command:

use Cake\Validation\Validator;  

$validator = new Validator();

27) Does Cake PHP support internationalization?

Yes, Cake PHP supports internationalization.

28) What is the latest version of Cak PHP?

The stable version of Cake PHP is 3.5.0.

29) What is the folder structure of CakePHP?

The folder of CakePHP is given below:

structure of CakePHP

30) How to display the schema of the model?

The following code is used to display the schema of the table.

pr($this->Post->schema());

31) How to get current URL in CakePHP?

The following code is used to get current URL in CakePHP.