Welcome to the Cookbook

loading...

Controller & Components

Controller

  • Controller::set() no longer changes variables from $var_name to $varName. Variables always appear in the view exactly as you set them.

  • Controller::set('title', $var) no longer sets $title_for_layout when rendering the layout. $title_for_layout is still populated by default. But if you want to customize it, use $this->set('title_for_layout', $var).

  • Controller::$pageTitle has been removed. Use $this->set('title_for_layout', $var); instead.

  • Controller has two new methods startupProcess and shutdownProcess. These methods are responsible for handling the controller startup and shutdown processes.

Component

  • Component::triggerCallback has been added. It is a generic hook into the component callback process. It supplants Component::startup(), Component::shutdown() and Component::beforeRender() as the preferred way to trigger callbacks.

CookieComponent

  • del is deprecated use delete

AclComponent + DbAcl

Node reference checks done with paths are now less greedy and will no longer consume intermediary nodes when doing searches. In the past given the structure:

ROOT/
    Users/
          Users/
                edit
  1. ROOT/
  2. Users/
  3. Users/
  4. edit

The path ROOT/Users would match the last Users node instead of the first. In 1.3, if you were expecting to get the last node you would need to use the path ROOT/Users/Users

RequestHandlerComponent

  • getReferrer is deprecated use getReferer

SessionComponent & SessionHelper

  • del is deprecated use delete

SessionComponent::setFlash() second param used to be used for setting the layout and accordingly rendered a layout file. This has been modifed to use an element. If you specified custom session flash layouts in your applications you will need to make the following changes.

  1. Move the required layout files into app/views/elements
  2. Rename the $content_for_layout variable to $message
  3. Make sure you have echo $session->flash(); in your layout
SessionComponent and SessionHelper are not automatically loaded.

Both SessionComponent and SessionHelper are no longer automatically included without you asking for them. SessionHelper and SessionComponent now act like every other component and must be declared like any other helper/component. You should update AppController::$components and AppController::$helpers to include these classes to retain existing behavior.

var $components = array('Session', 'Auth', ...);
var $helpers = array('Session', 'Html', 'Form' ...);
  1. var $components = array('Session', 'Auth', ...);
  2. var $helpers = array('Session', 'Html', 'Form' ...);

These change were done to make CakePHP more explicit and declarative in what classes you the application developer want to use. In the past there was no way to avoid loading the Session classes without modifying core files. Which is something we want you to be able to avoid. In addition Session classes were the only magical component and helper. This change helps unify and normalize behavior amongst all classes.