59
62

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CakePHPのControllerとComponentの実行順序

Posted at

CakePHPのコントローラとコンポーネントのcallbackは以下の順で実行されるようです。

  1. Controllerのinitialize()
  2. ComponentのbeforeFilter()
  3. ControllerのbeforeFilter()
  4. Componentのstartup()
  5. Controllerのaction
  6. ComponentのbeforeRender()
  7. ControllerのbeforeRender()
  8. Componentのshutdown()
  9. ControllerのafterFilter()

Authコンポーネントの認証処理は、4番目のstartup()に書かれているので、5番以降じゃないと認証済かどうか等の確認はできないので注意。

59
62
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
59
62

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?