Skip to content

Instantly share code, notes, and snippets.

@oh-sky
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oh-sky/4ce9aba4ece1142abaa8 to your computer and use it in GitHub Desktop.
Save oh-sky/4ce9aba4ece1142abaa8 to your computer and use it in GitHub Desktop.
CakePHP2 defined methods of Controller
App::uses('Controller', 'Controller');
AppController extends Controller {
public function __construct($request = null, $response = null) {
parent::__construct($request, $response);
// ここに書いた処理はComponent初期化より前に実行されます
}
public function startupProcess() {
// ここに書いた処理はComponent初期化より前に実行されます
// 親クラス(Controller)のstartupProcess()より前に書く必要があります。
parent::startupProcess();
}
public function beforeFilter() {
parent::beforeFilter();
// この中の処理はComponent初期化後に実行されます
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment