AbstractController
abstract class AbstractController implements ControllerInterface (View source)
An abstract base class for HTTP based controllers
Properties
protected UriBuilder | $uriBuilder | ||
protected ValidatorResolver | $validatorResolver | ||
protected ActionRequest | $request | The current action request directed to this controller |
|
protected ActionResponse deprecated | $response | The legacy response which will is provide by this action controller |
|
protected Arguments | $arguments | Arguments passed to the controller |
|
protected ControllerContext | $controllerContext | ||
protected PersistenceManagerInterface | $persistenceManager | ||
protected array | $supportedMediaTypes | A list of IANA media types which are supported by this controller |
|
protected string | $negotiatedMediaType | The media type that was negotiated by this controller |
Methods
Returns this controller's context.
Creates a Message object and adds it to the FlashMessageContainer.
Forwards the request to another action and / or controller.
Forwards the request to another action and / or controller.
Redirects the request to another action and / or controller.
Redirects the request to another action and / or controller.
Redirects to another URI
Sends the specified HTTP status immediately.
Maps arguments delivered by the request object to the local controller arguments.
Details
protected
initializeController(ActionRequest $request, ActionResponse $response)
Initializes the controller
This method should be called by the concrete processRequest() method.
ControllerContext
getControllerContext()
Returns this controller's context.
Note that the context is only available after processRequest() has been called.
void
addFlashMessage(string $messageBody, string $messageTitle = '', string $severity = Error\Message::SEVERITY_OK, array $messageArguments = [], int $messageCode = null)
Creates a Message object and adds it to the FlashMessageContainer.
This method should be used to add FlashMessages rather than interacting with the container directly.
protected never
forward(string $actionName, string $controllerName = null, string $packageKey = null, array $arguments = [])
Forwards the request to another action and / or controller.
Request is directly transferred to the other action / controller
protected never
forwardToRequest(ActionRequest $request)
Forwards the request to another action and / or controller.
Request is directly transfered to the other action / controller
protected never
redirect(string $actionName, string|null $controllerName = null, string|null $packageKey = null, array $arguments = [], int $delay = 0, int $statusCode = 303, string $format = null)
Redirects the request to another action and / or controller.
Redirect will be sent to the client which then performs another request to the new URI.
NOTE: This method only supports web requests and will throw an exception if used with other request types.
protected never
redirectToRequest(ActionRequest $request, int $delay = 0, int $statusCode = 303)
Redirects the request to another action and / or controller.
Redirect will be sent to the client which then performs another request to the new URI.
protected never
redirectToUri(UriInterface $uri, int $delay = 0, int $statusCode = 303)
Redirects to another URI
protected never
throwStatus(int $statusCode, string $statusMessage = null, string $content = null)
Sends the specified HTTP status immediately.
NOTE: This method only supports web requests and will throw an exception if used with other request types.
protected void
mapRequestArgumentsToControllerArguments(ActionRequest $request, Arguments $arguments)
Maps arguments delivered by the request object to the local controller arguments.