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 | $response | The response which will be returned 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
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 void
forwardToRequest(ActionRequest $request)
Forwards the request to another action and / or controller.
Request is directly transfered to the other action / controller
protected void
redirect(string $actionName, string $controllerName = null, string $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 void
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.
NOTE: This method only supports web requests and will throw an exception if used with other request types.
protected
redirectToUri(mixed $uri, int $delay = 0, int $statusCode = 303)
Redirects to another URI
protected
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()
Maps arguments delivered by the request object to the local controller arguments.