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().
또한 보기: Cake\Controller\Controller::$components
상속: implements Cake\Event\EventListenerInterface, use trait Cake\Core\InstanceConfigTrait, use trait Cake\Log\LogTrait
파일 보기 프로젝트 열기: cakephp/cakephp 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$components array Other Components this component uses.
$request Cake\Network\Request Request object
$response Cake\Network\Response Response object

보호된 프로퍼티들

프로퍼티 타입 설명
$_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.

공개 메소드들

메소드 설명
__construct ( Cake\Controller\ComponentRegistry $registry, array $config = [] ) Constructor
__debugInfo ( ) : array Returns an array that can be used to describe the internal state of this object.
__get ( string $name ) : mixed Magic method for lazy loading $components.
implementedEvents ( ) : array Get the Controller callbacks this Component is interested in.
initialize ( array $config ) : void Constructor hook method.

메소드 상세

__construct() 공개 메소드

Constructor
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.

__debugInfo() 공개 메소드

Returns an array that can be used to describe the internal state of this object.
public __debugInfo ( ) : array
리턴 array

__get() 공개 메소드

Magic method for lazy loading $components.
public __get ( string $name ) : mixed
$name string Name of component to get.
리턴 mixed A Component object or null.

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.
public implementedEvents ( ) : array
리턴 array

initialize() 공개 메소드

Implement this method to avoid having to overwrite the constructor and call parent.
public initialize ( array $config ) : void
$config array The configuration settings provided to this component.
리턴 void

프로퍼티 상세

$_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

$_registry 보호되어 있는 프로퍼티

Component registry class used to lazy load components.
protected ComponentRegistry,Cake\Controller $_registry
리턴 Cake\Controller\ComponentRegistry

$components 공개적으로 프로퍼티

Other Components this component uses.
public array $components
리턴 array

$request 공개적으로 프로퍼티

Request object
public Request,Cake\Network $request
리턴 Cake\Network\Request

$response 공개적으로 프로퍼티

Response object
public Response,Cake\Network $response
리턴 Cake\Network\Response