Class ControllerFactory

Factory method for building controllers for request.

Namespace: Cake\Controller

Method Summary

  • create() public

    Create a controller for a given request.

  • getControllerClass() public

    Determine the controller class name based on current request and controller param

  • invoke() public

    Invoke a controller's action and wrapping methods.

  • missingController() protected

    Throws an exception when a controller is missing.

Method Detail

create() public

create(\Psr\Http\Message\ServerRequestInterface $request)

Create a controller for a given request.

Parameters

\Psr\Http\Message\ServerRequestInterface $request

The request to build a controller for.

Returns

\Cake\Controller\Controller

Throws

Cake\Http\Exception\MissingControllerException

getControllerClass() public

getControllerClass(\Cake\Http\ServerRequest $request)

Determine the controller class name based on current request and controller param

Parameters

\Cake\Http\ServerRequest $request

The request to build a controller for.

Returns

string|null

invoke() public

invoke(mixed $controller)

Invoke a controller's action and wrapping methods.

Parameters

mixed $controller

The controller to invoke.

Returns

\Psr\Http\Message\ResponseInterface

The response

Throws

Cake\Controller\Exception\MissingActionException
If controller action is not found.
UnexpectedValueException
If return value of action method is not null or ResponseInterface instance.

missingController() protected

missingController(\Cake\Http\ServerRequest $request)

Throws an exception when a controller is missing.

Parameters

\Cake\Http\ServerRequest $request

The request.

Throws

Cake\Http\Exception\MissingControllerException

© 2005–present 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/4.1/class-Cake.Controller.ControllerFactory.html