CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.7 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.7
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • Dispatcher
  • DispatcherFactory
  • DispatcherFilter
  • RouteBuilder
  • Router

Traits

  • RequestActionTrait
  1: <?php
  2: /**
  3:  * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4:  * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5:  *
  6:  * Licensed under The MIT License
  7:  * For full copyright and license information, please see the LICENSE.txt
  8:  * Redistributions of files must retain the above copyright notice.
  9:  *
 10:  * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 11:  * @link          https://cakephp.org CakePHP(tm) Project
 12:  * @since         0.2.9
 13:  * @license       https://opensource.org/licenses/mit-license.php MIT License
 14:  */
 15: namespace Cake\Routing;
 16: 
 17: use Cake\Event\EventDispatcherTrait;
 18: use Cake\Event\EventListenerInterface;
 19: use Cake\Http\ActionDispatcher;
 20: use Cake\Http\Response;
 21: use Cake\Http\ServerRequest;
 22: 
 23: /**
 24:  * Dispatcher converts Requests into controller actions. It uses the dispatched Request
 25:  * to locate and load the correct controller. If found, the requested action is called on
 26:  * the controller
 27:  *
 28:  * @deprecated 3.6.0 Dispatcher is deprecated. You should update your application to use
 29:  *   the Http\Server implementation instead.
 30:  */
 31: class Dispatcher
 32: {
 33: 
 34:     use EventDispatcherTrait;
 35: 
 36:     /**
 37:      * Connected filter objects
 38:      *
 39:      * @var \Cake\Event\EventListenerInterface[]
 40:      */
 41:     protected $_filters = [];
 42: 
 43:     /**
 44:      * Dispatches and invokes given Request, handing over control to the involved controller. If the controller is set
 45:      * to autoRender, via Controller::$autoRender, then Dispatcher will render the view.
 46:      *
 47:      * Actions in CakePHP can be any public method on a controller, that is not declared in Controller. If you
 48:      * want controller methods to be public and in-accessible by URL, then prefix them with a `_`.
 49:      * For example `public function _loadPosts() { }` would not be accessible via URL. Private and protected methods
 50:      * are also not accessible via URL.
 51:      *
 52:      * If no controller of given name can be found, invoke() will throw an exception.
 53:      * If the controller is found, and the action is not found an exception will be thrown.
 54:      *
 55:      * @param \Cake\Http\ServerRequest $request Request object to dispatch.
 56:      * @param \Cake\Http\Response $response Response object to put the results of the dispatch into.
 57:      * @return string|null if `$request['return']` is set then it returns response body, null otherwise
 58:      * @throws \LogicException When the controller did not get created in the Dispatcher.beforeDispatch event.
 59:      */
 60:     public function dispatch(ServerRequest $request, Response $response)
 61:     {
 62:         deprecationWarning(
 63:             'Dispatcher is deprecated. You should update your application to use ' .
 64:             'the Http\Server implementation instead.'
 65:         );
 66:         $actionDispatcher = new ActionDispatcher(null, $this->getEventManager(), $this->_filters);
 67:         $response = $actionDispatcher->dispatch($request, $response);
 68:         if ($request->getParam('return', null) !== null) {
 69:             return $response->body();
 70:         }
 71: 
 72:         return $response->send();
 73:     }
 74: 
 75:     /**
 76:      * Add a filter to this dispatcher.
 77:      *
 78:      * The added filter will be attached to the event manager used
 79:      * by this dispatcher.
 80:      *
 81:      * @param \Cake\Event\EventListenerInterface $filter The filter to connect. Can be
 82:      *   any EventListenerInterface. Typically an instance of \Cake\Routing\DispatcherFilter.
 83:      * @return void
 84:      */
 85:     public function addFilter(EventListenerInterface $filter)
 86:     {
 87:         $this->_filters[] = $filter;
 88:     }
 89: 
 90:     /**
 91:      * Get the list of connected filters.
 92:      *
 93:      * @return \Cake\Event\EventListenerInterface[]
 94:      */
 95:     public function filters()
 96:     {
 97:         return $this->_filters;
 98:     }
 99: }
100: 
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs