A dispatcher filter that applies routing rules to the request.
This filter will call Router::parse() when the request has no controller parameter defined.
$_priority
protected integer
Applies Routing and additionalParameters to the request to be dispatched. If Routes have not been loaded they will be loaded, and config/routes.php will be run.
beforeDispatch( Cake\Event\Event $event )
Applies Routing and additionalParameters to the request to be dispatched. If Routes have not been loaded they will be loaded, and config/routes.php will be run.
Cake\Event\Event
$event
Cake\Routing\DispatcherFilter::beforeDispatch()
__construct( array $config [] )
Constructor.
$config
optional [] afterDispatch( Cake\Event\Event $event )
Method called after the controller served a request and generated a response. It is possible to alter the response object at this point as it is not sent to the client yet.
If false is returned, the event will be stopped and no more listeners will be notified. Alternatively you can call $event->stopPropagation()
to achieve the same result.
Cake\Event\Event
$event
container object having the request
and response
keys in the data property.
handle( Cake\Event\Event $event )
Handler method that applies conditions and resolves the correct method to call.
Cake\Event\Event
$event
implementedEvents( )
Returns the list of events this filter listens to. Dispatcher notifies 2 different events Dispatcher.before
and Dispatcher.after
. By default this class will attach preDispatch
and postDispatch
method respectively.
Override this method at will to only listen to the events you are interested in.
Cake\Event\EventListenerInterface::implementedEvents()
matches( Cake\Event\Event $event )
Check to see if the incoming request matches this filter's criteria.
Cake\Event\Event
$event
_configDelete( string $key )
Deletes a single config key.
$key
Cake\Core\Exception\Exception
_configRead( string|null $key )
Reads a config key.
$key
_configWrite( string|array $key , mixed $value , boolean|string $merge false )
Writes a config key.
$key
$value
$merge
optional false True to merge recursively, 'shallow' for simple merge, false to overwrite, defaults to false.
Cake\Core\Exception\Exception
config( string|array|null $key null , mixed|null $value null , boolean $merge true )
Gets/Sets the config.
Reading the whole config:
$this->config();
Reading a specific value:
$this->config('key');
Reading a nested value:
$this->config('some.nested.key');
Setting a specific value:
$this->config('key', $value);
Setting a nested value:
$this->config('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->config(['one' => 'value', 'another' => 'value']);
$key
optional null $value
optional null $merge
optional true Cake\Core\Exception\Exception
configShallow( string|array $key , mixed|null $value null )
Merge provided config with existing config. Unlike config()
which does a recursive merge for nested keys, this method does a simple merge.
Setting a specific value:
$this->config('key', $value);
Setting a nested value:
$this->config('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->config(['one' => 'value', 'another' => 'value']);
$key
$value
optional null getConfig( string|null $key null )
Returns the config.
Reading the whole config:
$this->getConfig();
Reading a specific value:
$this->getConfig('key');
Reading a nested value:
$this->getConfig('some.nested.key');
$key
optional null setConfig( string|array $key , mixed|null $value null , boolean $merge true )
Sets the config.
Setting a specific value:
$this->setConfig('key', $value);
Setting a nested value:
$this->setConfig('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->setConfig(['one' => 'value', 'another' => 'value']);
$key
$value
optional null $merge
optional true Cake\Core\Exception\Exception
protected integer
Priority setting.
This filter is normally fired last just before the request is dispatched.
10
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.4/class-Cake.Routing.Filter.RoutingFilter.html