I am moving from CakePHP 2.x, and I don’t understand what the difference is between initialize() and beforeFilter() . Between them, it seems, a lot of coincidences. When should I use one and not the other?
initialize()
beforeFilter()
This is the order in which events occur. initialize() is called immediately after the __construct() method, while beforeFilter() is called only when the action is beforeFilter() .
__construct()
initialize() always called.
beforeFilter() is optional. If present, it is:
called before the beforeFilter controller, but after the initialifiers () method.
http://book.cakephp.org/3.0/en/controllers/components.html#component-callbacks
Source: https://habr.com/ru/post/985629/More articles:sorting an array of type object using the Arrays.sort () method - javaWaiting for intent with the ONE_SHOT symbol - androidmedian pandas dataframe - pythonHow to add a font-awesome icon to the kendo UI MVC menu? - font-awesomeWhy is "movl $ 1,% edx" instead of "movl $ 0,% edx" in do while - cGradle Warning "not specified, depends on libraries, but is a jar" when compiling the android module in the user module of the java library - javaIgnore project in Visual Studio during debugging - .netSending email without a user Interaction - Android Studio - javaTDD and Using Views in Laravel 5 - laravelHow can I use Protractor with google.com? - seleniumAll Articles