Свойство | 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 |
Свойство | 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. |
Méthode | 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. |
Méthode | 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 | ||
Résultat | void |
protected _mergeControllerVars ( ) : void | ||
Résultat | void |
public afterFilter ( Cake\Event\Event $event ) : |
||
$event | Cake\Event\Event | An Event instance |
Résultat |
public beforeFilter ( Cake\Event\Event $event ) : |
||
$event | Cake\Event\Event | An Event instance |
Résultat |
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. | |
Résultat |
public beforeRender ( Cake\Event\Event $event ) : |
||
$event | Cake\Event\Event | An Event instance |
Résultat |
public components ( Cake\Controller\ComponentRegistry | null $components = null ) : Cake\Controller\ComponentRegistry | ||
$components | Cake\Controller\ComponentRegistry | null | Component registry. |
Résultat | Cake\Controller\ComponentRegistry |
public implementedEvents ( ) : array | ||
Résultat | array |
public initialize ( ) : void | ||
Résultat | void |
public invokeAction ( ) : mixed | ||
Résultat | 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. |
Résultat |
public paginate ( |
||
$object | Table to paginate (e.g: Table instance, 'TableName' or a Query object) | |
$settings | array | The settings/configuration used for pagination. |
Résultat | Cake\ORM\ResultSet | Query results |
public setRequest ( Cake\Network\Request $request ) : void | ||
$request | Cake\Network\Request | Request instance. |
Résultat | void |
public shutdownProcess ( ) : |
||
Résultat |
public startupProcess ( ) : |
||
Résultat |
public View,Cake\View $View | ||
Résultat | Cake\View\View |
protected ComponentRegistry,Cake\Controller $_components | ||
Résultat | Cake\Controller\ComponentRegistry |
protected string $_responseClass | ||
Résultat | string |
protected array $_validViewOptions | ||
Résultat | array |
public bool $autoRender | ||
Résultat | boolean |
public array $components | ||
Résultat | array |
public array $helpers | ||
Résultat | array |
public string $name | ||
Résultat | string |
public array $paginate | ||
Résultat | array |
public string $plugin | ||
Résultat | string |
public Request,Cake\Network $request | ||
Résultat | Cake\Network\Request |