PHP 클래스 Cake\Controller\Component
### Initialize hook
Like Controller and Table, this class has an initialize() hook that you can use
to add custom 'constructor' logic. It is important to remember that each request
(and sub-request) will only make one instance of any given component.
### Life cycle callbacks
Components can provide several callbacks that are fired at various stages of the request
cycle. The available callbacks are:
-
beforeFilter(Event $event)
Called before the controller's beforeFilter method by default.
-
startup(Event $event)
Called after the controller's beforeFilter method, and before the
controller action is called.
-
beforeRender(Event $event)
Called before the Controller beforeRender, and before the view class is loaded.
-
shutdown(Event $event)
Called after the action is complete and the view has been rendered but
before Controller::afterFilter().
-
beforeRedirect(Event $event $url, Response $response)
Called before a redirect is done. Allows you to change the URL that will
be redirected to by returning a Response instance with new URL set using
Response::location(). Redirection can be prevented by stopping the event
propagation.
While the controller is not an explicit argument for the callback methods it
is the subject of each event and can be fetched using Event::subject().
파일 보기
프로젝트 열기: cakephp/cakephp
1 사용 예제들
공개 프로퍼티들
보호된 프로퍼티들
프로퍼티 |
타입 |
설명 |
|
$_componentMap |
array |
A component lookup table used to lazy load component objects. |
|
$_defaultConfig |
array |
These are merged with user-provided config when the component is used. |
|
$_registry |
Cake\Controller\ComponentRegistry |
Component registry class used to lazy load components. |
|
공개 메소드들
메소드 상세
public __construct ( Cake\Controller\ComponentRegistry $registry, array $config = [] ) |
$registry |
Cake\Controller\ComponentRegistry |
A ComponentRegistry this component can use to lazy load its components |
$config |
array |
Array of configuration settings. |
Returns an array that can be used to describe the internal state of this
object.
Magic method for lazy loading $components.
implementedEvents()
공개 메소드
Uses Conventions to map controller events to standard component
callback method names. By defining one of the callback methods a
component is assumed to be interested in the related event.
Override this method if you need to add non-conventional event listeners.
Or if you want components to listen to non-standard events.
Implement this method to avoid having to overwrite
the constructor and call parent.
프로퍼티 상세
$_componentMap 보호되어 있는 프로퍼티
A component lookup table used to lazy load component objects.
protected array $_componentMap |
리턴 |
array |
|
$_defaultConfig 보호되어 있는 프로퍼티
These are merged with user-provided config when the component is used.
protected array $_defaultConfig |
리턴 |
array |
|
Component registry class used to lazy load components.
protected ComponentRegistry,Cake\Controller $_registry |
리턴 |
Cake\Controller\ComponentRegistry |
|
Other Components this component uses.
public array $components |
리턴 |
array |
|
public Request,Cake\Network $request |
리턴 |
Cake\Network\Request |
|
public Response,Cake\Network $response |
리턴 |
Cake\Network\Response |
|