Cakephp Interview Questions with Answers
Question: 1. What Is Cakephp?
Answer:
CakePHP is a loose, open-source, fast improvement framework for PHP. It’s a foundational shape for programmers to create net applications. CakePHP goal is to permit builders to paintings in a structured and fast manner–with out loss of flexibility. CakePHP takes the monotony out of net improvement.
Question: 2. When Cakephp Was Developed?
Answer:
CakePHP started in April 2005.When a Polish programmer Michal Tatarynowicz wrote a minimal version of a Rapid Application Framework in PHP, dubbing it Cake.CakePHP model 1.Zero released in May 2006.
PHP Interview Questions
Question: 3. What Is The Current Stable Version Of Cakephp?
Answer:
three.Zero (on date 2015-06-12).
Question: four. What Is Mvc In Cakephp?
Answer:
Model view controller (MVC) is an architectural sample utilized in software program engineering.
Model : Database features exist within the model
View : Design parts written here
Controller : Business Logic goes here
PHP Tutorial
Question: 5. Server Requirements For Cakephp?
Answer:
Here are the necessities for putting in place a server to run CakePHP:
An HTTP server (like Apache) with the following enabled: periods, mod_rewrite (not genuinely essential however preferred)
PHP four.3.2 or more. Yes, CakePHP works excellent in both PHP four or 5.
A database engine (right now, there’s assist for MySQL 4+, PostgreSQL and a wrapper for ADODB).
MySQL Interview Questions
Question: 6. How To Install Cakephp?
Answer:
step1: Go to cakephp.Org and download the modern-day version of cakephp.
Step2: Cakephp is available in a .Zip report,so unzip it.
Step3: Extract the documents in the localhost in the preferred folder (as an instance:cakephp).
Step4: Open the browser and run the URL localhost/cakephp
step5: Just Follow the instructions display on the page.
Question: 7. What Is The Folder Structure Of Cakephp?
Answer:
cakephp/
app/
Config/
Console/
Controller/
Lib/
Locale/
Model/
Plugin/
Test/
tmp/
Vendor/
View/
webroot/
.Htaccess
index.Php
lib/
plugins/
carriers/
.Htaccess/
index.Hypertext Preprocessor/
README.Md/
MySQL Tutorial PHP+MySQL Interview Questions
Question: eight. What Is The Name Of Cakephp Database Configuration File Name And Its Location?
Answer:
Default report name is database.Personal home page.Default.
Its placed at “/app/config/database.Hypertext Preprocessor.Default”.To connect to database it must be renamed to database.Personal home page
Question: 9. What Is The First File That Gets Loaded When You Run A Application Using Cakephp?Can You Change That File?
Answer:
bootstrap.Php
sure it can be modified.Either thru index.Hypertext Preprocessor , or thru .Htaccess
Drupal Interview Questions
Question: 10. What Is The Use Of Security.Salt And Security.Cipherseed In Cakephp? How To Change Its Default Value?
Answer:
The Security.Salt is used for producing hashes.We can alternate the default Security.Salt price in /app/Config/center.Php.
The Security.Cipherseed is used for encrypt/decrypt strings.We can change the default Security.CipherSeed value through modifying /app/Config/core.Hypertext Preprocessor.
Drupal Tutorial
Question: eleven. What Are Controllers?
Answer:
A controller is used to control the good judgment for a part of your application. Most generally, controllers are used to control the common sense for a single model. Controllers can include any quantity of methods that are generally referred to as actions. Actions are controller strategies used to show views. An action is a unmarried technique of a controller.
MYSQL DBA Interview Questions
Question: 12. What Is Default Function For A Controller?
Answer:
index() characteristic
PHP Interview Questions
Question: 13. Which Function Is Executed Before Every Action In The Controller?
Answer:
function beforeFilter()
WordPress Tutorial
Question: 14. List Some Of The Features In Cakephp?
Answer:
Compatible with versions 4 and 5 of PHP
MVC structure
Built-in validations
Caching
Scaffolding
Access Control Lists and Authentication.
CSRF safety thru Security Component.
Question: 15. Using Cakephp, What All Are Drawbacks?
Answer:
It hundreds complete application earlier than it begins your assignment. It’s now not endorsed for small initiatives due to its aid-heavy structure.
PHP5 Interview Questions
Question: 16. What Is The Naming Convention In Cakephp?
Answer:
Table names are plural and lowercased,version names are singular and CamelCased: ModelName, version filenames are singular and underscored: model_name.Php, controller names are plural and CamelCased with *Controller* appended: ControllerNamesController, controller filenames are plural and underscored with *controller* appended: controller_names_controller.Personal home page.
Joomla Tutorial
Question: 17. What Is Scaffolding In Cakephp?
Answer:
Scaffolding is a way that allows a developer to define and create a basic utility that may create, retrieve, update and delete items.
WordPress Interview Questions
Question: 18. How To Add Scaffolding In Your Application?
Answer:
To upload scaffolding on your software,simply add the $scaffold variable inside the controller,
class PostsController extends AppController
var $scaffold;
?>
Assuming you’ve created Post version class record (in /app/Model/submit.Php).
MySQL Interview Questions
Question: 19. What Is A Component In Cakephp?
Answer:
Components are programs of good judgment which can be shared among controllers. They are beneficial while a not unusual logic or code is needed among specific controllers.
CakePHP Tutorial
Question: 20. What Are Commonly Used Components Of Cakephp?
Answer:
Security
Sessions
Access manipulate lists
Emails
Cookies
Authentication
Request handling
Scaffolding
Joomla Interview Questions
Question: 21. What Is A Helper?
Answer:
Helpers in CakePHP are related to Presentation layers of utility.Helpers in particular contain presentational good judgment which is to be had to share among many views, factors, or layouts.
Question: 22. What Are Commonly Used Helpers Of Cakephp?
Answer:
FormHelper
HtmlHelper
JsHelper
CacheHelper
NumberHelper
Paginator
RSS
SessionHelper
TextHelper
TimeHelper
CodeIgniter Tutorial
Question: 23. What Is A Behavior?
Answer:
Behaviors in CakePHP are associated with Models.Behaviors are used to change the manner models behaves and imposing model to behave as some thing else.
CodeIgniter Interview Questions
Question: 24. What Is The Difference Between Component, Helper, Behavior?
Answer:
Component is a Controller extension, Helpers are View extensions, Behavior is a Model Extension.
PHP+MySQL Interview Questions
Question: 25. What Is A Element?
Answer:
Element in cakephp are smaller and reusable bits of view code. Elements are typically rendered inner perspectives.
PHP7 Tutorial
Question: 26. What Is A Layout?
Answer:
Layout in cakephp are used to show the perspectives that incorporate presentational code. In easy views are rendered interior a layout.
PHP7 Interview Questions
Question: 27. How To Set Layout In The Controller?
Answer:
var $layout = ‘layout_name’;
to overwrite for a specific motion use beneath code in that action
$this->format =”layout_name”;
Drupal Interview Questions
Question: 28. How To Include Helpers In Controller ?
Answer:
public $helpers = array(‘Form’, ‘Html’, ‘Js’, ‘Time’);
to in particular movement use under code in that action
$this->helper[] =”helper_name”;
Question: 29. How To Include Components In Controller ?
Answer:
public $additives = array(‘Emails’, ‘ImageUploader’, ‘Sms’);
Question: 30. How To Write, Read And Delete The Session In Cakephp?
Answer:
$this->Session->write(‘Bird.Color’, ‘Black’);
$black = $this->Session->examine(‘Bird.Color’);
$this->Session->delete(‘Bird’);
Question: 31. What Is The Use Of $this->set();
Answer:
The set() method is used for growing a variable in the view file.Say as an instance if we write,
$this->set(‘posts’,$posts); in controller fie, then the variable $posts can be available to apply within the view template document for that motion.
Question: 32. What Is The Use Of $this->set(compact());?
Answer:
Using $this->set(compact()) , we are able to bypass more than one parameters to access into the view file.
For instance,
$this->set(compact(‘posts’,’customers’,’reports’));
Now these types of variables might be to be had in respective view report.
Question: 33. What Are The Advantages Of Each?Which Would You Use And Why?
Answer:
An benefit with first case $this->set(‘posts’, $posts); is that it lets in exceptional names for the view document and controller document. For example, you could write something like $this->set(‘postData’, $posts);. Now the variable call inside the view report could be $postData.
The gain with the second technique $this->set(compact()); is easier to jot down, and useful specially whilst we are putting numerous variables to the view.No need to add separate line for each variable as we’ve with $this->set();
For instance,
$this->set(compact(‘posts’,’users’,’reports’));
MYSQL DBA Interview Questions
Question: 34. Is It Possible To Have Multiple Validation Rules Per Field In Cakephp?
Answer:
Yes its possible.
Question: 35. What Is Wrong With The Below Validation Rule?
Answer:
‘e mail’ => array(
‘rule’ => array(
‘rule’ => ‘notEmpty’,
‘message’ => ‘Please Enter Email address.’
),
‘rule’ => array(
‘rule’ => ’email’,
‘message’ => ‘Entered Email deal with is invalid.’
)
)
The problem is the primary rule notEmpty will never be known as because e-mail rule will overwrite it.While using multiple validation rules for the equal area you must hold the rule key “particular”. In this situation if we want to use more than one guidelines then, we are able to simple change the rule key names like,
‘e mail’ => array(
‘rule1’ => array(
‘rule’ => ‘notEmpty’,
‘message’ => ‘Please Enter Email address.’
),
‘rule2’ => array(
‘rule’ => ’email’,
‘message’ => ‘Entered Email deal with is invalid.’
)
)
Question: 36. How To Get Current Url In Cakephp?
Answer:
To get cutting-edge url in cakephp use,
echo Router::url($this->right here, real);
This will deliver complete URL with hostname.If you need to get relative route rather than complete URL,then use the subsequent code:
echo $this->right here;
This will produce absolute URL with the exception of hostname i.E. /controller/abc/xyz/
PHP5 Interview Questions
Question: 37. How Can You Make Urls Search Engine Friendly While Using Cakephp?
Answer:
It’s an automatic challenge this is achieved by means of cakephp.
Question: 38. Can You List Some Database Related Functions In Cakephp?
Answer:
find, findAll , findAllBy , findBy , findNeighbours and question.
Question: 39. Which Methods Are Used To Create And Destroy Model Associations On The Fly?
Answer:
The bindModel() and unbindModel() Model strategies are used to create and ruin version associations on the fly.
Question: forty. What Is The Use Of Requestaction Method?
Answer:
The technique requestAction is used to name a controller’s movement from any area and returns records from the movement.
WordPress Interview Questions
Question: forty one. What Is Recursive In Cakephp?
Answer:
To apprehend this subject matter follow this post :
Recursive in cakephp
Question: 42. How Can We Use Ajax In Cakephp?
Answer:
By calling ajax helper and then the usage of it in controller for rendering.
Joomla Interview Questions
Question: forty three. What Is Habtm?
Answer:
Has and belongs to many is a type of associations that may be described in fashions for retrieving associated facts throughout extraordinary entities.
Question: 44. How Can You Include A Javascript Menu Throughout The Site. Give Steps.
Answer:
By adding the javascript files in webroot and call them in default views if wished everywhere or simply inside the associated veiws.
Question: forty five. Why Cakephp Have Two Vendor Folder?What Is The Difference Between Two Vendors Folder Available In Cakephp?
Answer:
There can be two supplier folders available in cakephp body work.
One in ” app ” folder and one in root folder
The seller folder in the app folder is used to location the 0.33-birthday celebration libraries which are application particular.
The vendor folder in the root folder is used to area the third-party libraries which might be used for more than one applications.
Question: 46. What Is The Default Extension Of View Files In Cakephp?Can We Change It?If Yes Then How?
Answer:
default extension of view files is ‘.Ctp’.
Sure we are able to exchange it by means of writing public $ext = ‘.Yourext’; in AppController.If you want to change it for specific controller then add it into that controller handiest.You can also alternate it for the unique motion of the controller by using placing it in that motion of controller.
Public $ext = ‘.Yourext’; in AppController
– you could exchange all the perspectives extentions.
Public $ext = ‘.Yourext’; in precise controller like, PostsController
– you could change all the views extentions of PostsController.
Public $ext = ‘.Yourext’; in particular controller action like, index()
– you could trade the view extention of index.Ctp
Note: You can not specify more than one extensions, but it looks like there’s a fall again to .Ctp if no .Php document is determined.
Question: 47. How Can You Set Custom Page Title For The Static Page?
Answer:
To set a custom page title, copy-paste following code everywhere in your static web page (.Ctp) report:
$this->set(“title_for_layout”, “My page title”);
Question: forty eight. How To Display The Schema Of The Model?
Answer:
If you want to show the schema of unique version then you definitely simply need to feature the following single line of code.For instance we’ve “Posts” Controller.
Pr($this->Post->schema());
Question: 49. What Is Cakephp Request Cycle?
Answer:
A common CakePHP request cycle starts with a person asking for a page or aid to your utility. At a high degree, every request goes thru the following steps −
The webserver rewrite guidelines direct the request to webroot/index.Personal home page.
Your application’s autoloader and bootstrap documents are completed.
Any dispatch filters which can be configured can manage the request, and optionally generate a reaction.
The dispatcher selects the appropriate controller & movement based totally on routing rules.
The controller’s action is referred to as and the controller interacts with the desired Models and Components.
The controller delegates reaction advent to the View to generate the output due to the model statistics.
The view makes use of Helpers and Cells to generate the response frame and headers.
The reaction is sent back to the patron.
Question: 50. What Is Email Configuration In Cakephp?
Answer:
Email may be configured in file config/app.Hypertext Preprocessor. It isn’t required to define e-mail configuration in config/app.Hypertext Preprocessor. Email may be used with out it; just use the respective strategies to set all configurations one at a time or load an array of configs. Configuration for Email defaults is created using config() and configTransport().
