Property | Type | Description | |
---|---|---|---|
$View | Cake\View\View | Instance of the View created during rendering. Won't be set until after Controller::render() is called. | |
$autoRender | boolean | Set to true to automatically render the view after action logic. | |
$components | array | Example: public $components = ['RequestHandler', 'Acl']; | |
$helpers | array | Example: public $helpers = ['Form', 'Html', 'Time']; | |
$name | string | Set automatically using conventions in Controller::__construct(). | |
$paginate | array | Used to pre-configure pagination preferences for the various tables your controller will be paginating. | |
$passedArgs | array | Holds all passed params. | |
$plugin | string | Automatically set to the name of a plugin. | |
$request | Cake\Network\Request | This object contains all the information about a request and several methods for reading additional information about the request. | |
$response | An instance of a Response object that contains information about the impending response |
Property | Type | Description | |
---|---|---|---|
$_components | Cake\Controller\ComponentRegistry | Instance of ComponentRegistry used to create Components | |
$_responseClass | string | The class name to use for creating the response object. | |
$_validViewOptions | array | These Controller properties will be passed from the Controller to the View as options. |
Method | Description | |
---|---|---|
__construct ( Cake\Network\Request $request = null, |
Constructor. | |
__get ( string $name ) : boolean | object | Magic accessor for model autoloading. | |
__set ( string $name, mixed $value ) : void | Magic setter for removed properties. | |
afterFilter ( Cake\Event\Event $event ) : |
Called after the controller action is run and rendered. | |
beforeFilter ( Cake\Event\Event $event ) : |
Called before the controller action. You can use this method to configure and customize components or perform logic that needs to happen before each controller action. | |
beforeRedirect ( Cake\Event\Event $event, string | array $url, |
The beforeRedirect method is invoked when the controller's redirect method is called but before any further action. | |
beforeRender ( Cake\Event\Event $event ) : |
Called after the controller action is run, but before the view is rendered. You can use this method to perform logic or set view variables that are required on every request. | |
components ( Cake\Controller\ComponentRegistry | null $components = null ) : Cake\Controller\ComponentRegistry | Get the component registry for this controller. | |
implementedEvents ( ) : array | Returns a list of all events that will fire in the controller during its lifecycle. | |
initialize ( ) : void | Initialization hook method. | |
invokeAction ( ) : mixed | Dispatches the controller action. Checks that the action exists and isn't private. | |
isAction ( string $action ) : boolean | Method to check that an action is accessible from a URL. | |
loadComponent ( string $name, array $config = [] ) : |
Add a component to the controller's registry. | |
paginate ( |
Handles pagination of records in Table objects. | |
redirect ( string | array $url, integer $status = 302 ) : |
Redirects to given $url, after turning off $this->autoRender. | |
referer ( string | array | null $default = null, boolean $local = false ) : string | Returns the referring URL for this request. | |
render ( string | null $view = null, string | null $layout = null ) : |
Instantiates the correct view class, hands it its data, and uses it to render the view output. | |
setAction ( string $action ) : mixed | Internally redirects one action to another. Does not perform another HTTP request unlike Controller::redirect() | |
setRequest ( Cake\Network\Request $request ) : void | Sets the request objects and configures a number of controller properties based on the contents of the request. Controller acts as a proxy for certain View variables which must also be updated here. The properties that get set are: | |
shutdownProcess ( ) : |
Perform the various shutdown processes for this controller. | |
startupProcess ( ) : |
Perform the startup process for this controller. |
Method | Description | |
---|---|---|
_loadComponents ( ) : void | Loads the defined components using the Component factory. | |
_mergeControllerVars ( ) : void | Merge components, helpers vars from parent classes. | |
_viewPath ( ) : string | Get the viewPath based on controller name and request prefix. |
public __construct ( Cake\Network\Request $request = null, |
||
$request | Cake\Network\Request | Request object for this controller. Can be null for testing, but expect that features that use the request parameters will not work. |
$response | Response object for this controller. | |
$name | string | null | Override the name useful in testing when using mocks. |
$eventManager | Cake\Event\EventManager | null | The event manager. Defaults to a new instance. |
$components | Cake\Controller\ComponentRegistry | null | The component registry. Defaults to a new instance. |
protected _loadComponents ( ) : void | ||
return | void |
protected _mergeControllerVars ( ) : void | ||
return | void |
public afterFilter ( Cake\Event\Event $event ) : |
||
$event | Cake\Event\Event | An Event instance |
return |
public beforeFilter ( Cake\Event\Event $event ) : |
||
$event | Cake\Event\Event | An Event instance |
return |
public beforeRedirect ( Cake\Event\Event $event, string | array $url, |
||
$event | Cake\Event\Event | An Event instance |
$url | string | array | A string or array-based URL pointing to another location within the app, or an absolute URL |
$response | The response object. | |
return |
public beforeRender ( Cake\Event\Event $event ) : |
||
$event | Cake\Event\Event | An Event instance |
return |
public components ( Cake\Controller\ComponentRegistry | null $components = null ) : Cake\Controller\ComponentRegistry | ||
$components | Cake\Controller\ComponentRegistry | null | Component registry. |
return | Cake\Controller\ComponentRegistry |
public implementedEvents ( ) : array | ||
return | array |
public initialize ( ) : void | ||
return | void |
public invokeAction ( ) : mixed | ||
return | mixed | The resulting response. |
public loadComponent ( string $name, array $config = [] ) : |
||
$name | string | The name of the component to load. |
$config | array | The config for the component. |
return |
public paginate ( |
||
$object | Table to paginate (e.g: Table instance, 'TableName' or a Query object) | |
$settings | array | The settings/configuration used for pagination. |
return | Cake\ORM\ResultSet | Query results |
public setRequest ( Cake\Network\Request $request ) : void | ||
$request | Cake\Network\Request | Request instance. |
return | void |
public shutdownProcess ( ) : |
||
return |
public startupProcess ( ) : |
||
return |
public View,Cake\View $View | ||
return | Cake\View\View |
protected ComponentRegistry,Cake\Controller $_components | ||
return | Cake\Controller\ComponentRegistry |
protected string $_responseClass | ||
return | string |
protected array $_validViewOptions | ||
return | array |
public bool $autoRender | ||
return | boolean |
public array $components | ||
return | array |
public array $helpers | ||
return | array |
public string $name | ||
return | string |
public array $paginate | ||
return | array |
public string $plugin | ||
return | string |
public Request,Cake\Network $request | ||
return | Cake\Network\Request |