ActionRequest
class ActionRequest implements RequestInterface (View source)
Represents an internal request targeted to a controller action
Properties
protected ObjectManagerInterface | $objectManager | ||
protected HashService | $hashService | ||
protected PackageManager | $packageManager | ||
protected string | $controllerPackageKey | Package key of the controller which is supposed to handle this request. |
|
protected string|null | $controllerSubpackageKey | Subpackage key of the controller which is supposed to handle this request. |
|
protected string | $controllerName | Object name of the controller which is supposed to handle this request. |
|
protected string | $controllerActionName | Name of the action the controller is supposed to take. |
|
protected array | $arguments | The arguments for this request. They must be only simple types, no objects allowed. |
|
protected array | $internalArguments | Framework-internal arguments for this request, such as __referrer. |
|
protected array | $pluginArguments | Arguments and configuration for plugins – including widgets – which are sub controllers to the controller referred to by this request. |
|
protected string | $argumentNamespace | An optional namespace for arguments of this request. Used, for example, in plugins and widgets. |
|
protected string | $format | The requested representation format |
|
protected bool | $dispatched | If this request has been changed and needs to be dispatched again |
|
protected ActionRequest | $parentRequest | The parent request – either another ActionRequest or Http Request |
|
protected ServerRequestInterface | $rootRequest | Cached pointer to the root request (usually an HTTP request) |
|
protected ActionRequest | $referringRequest | Cached pointer to a request referring to this one (if any) |
Methods
No description
Create a sub request from this action request.
Returns the parent request
Returns the top level request: the HTTP request object
Returns the top level ActionRequest: the one just below the HTTP request
Checks if this request is the uppermost ActionRequest, just one below the HTTP request.
Returns an ActionRequest which referred to this request, if any.
Sets the dispatched flag
If this request has been dispatched and addressed by the responsible controller and the response is ready to be sent.
Returns the object name of the controller defined by the package key and controller name
Explicitly sets the object name of the controller
Sets the package key of the controller.
Returns the package key of the specified controller.
Sets the subpackage key of the controller.
Returns the subpackage key of the specified controller.
Sets the name of the controller which is supposed to handle the request.
Returns the object name of the controller supposed to handle this request, if one was set already (if not, the name of the default controller is returned)
Sets the name of the action contained in this request.
Returns the name of the action the controller is supposed to execute.
Sets the value of the specified argument
Returns the value of the specified argument
Checks if an argument of the given name exists (is set)
Sets the specified arguments.
Returns an Array of arguments and their values
Returns the value of the specified internal argument.
Returns the internal arguments of the request, that is, all arguments whose name starts with two underscores.
Sets a namespace for the arguments of this request.
Returns the argument namespace, if any.
Returns an array of plugin argument configurations
Sets the requested representation format
Returns the requested representation format
Resets the dispatched status to false
We provide our own __sleep method, where we serialize all properties except the parentRequest if it is a HTTP request -- as this one contains $_SERVER etc.
Details
protected
__construct(ActionRequest|ServerRequestInterface $parentRequest)
Constructs this action request
static ActionRequest
fromHttpRequest(ServerRequestInterface $request)
No description
ActionRequest
createSubRequest()
Create a sub request from this action request.
ActionRequest|null
getParentRequest()
Returns the parent request
ServerRequestInterface
getHttpRequest()
Returns the top level request: the HTTP request object
RequestInterface
getMainRequest()
Returns the top level ActionRequest: the one just below the HTTP request
bool
isMainRequest()
Checks if this request is the uppermost ActionRequest, just one below the HTTP request.
ActionRequest|null
getReferringRequest()
Returns an ActionRequest which referred to this request, if any.
The referring request is not set or determined automatically but must be explicitly set through the corresponding internal argument "__referrer". This mechanism is used by Flow's form and validation mechanisms.
void
setDispatched(bool $flag)
Sets the dispatched flag
bool
isDispatched()
If this request has been dispatched and addressed by the responsible controller and the response is ready to be sent.
The dispatcher will try to dispatch the request again if it has not been addressed yet.
string
getControllerObjectName()
Returns the object name of the controller defined by the package key and controller name
void
setControllerObjectName(string $unknownCasedControllerObjectName)
Explicitly sets the object name of the controller
void
setControllerPackageKey(string $packageKey)
Sets the package key of the controller.
This function tries to determine the correct case for the given package key. If the Package Manager does not know the specified package, the package key cannot be verified or corrected and is stored as is.
string
getControllerPackageKey()
Returns the package key of the specified controller.
void
setControllerSubpackageKey(string|null $subpackageKey)
Sets the subpackage key of the controller.
string|null
getControllerSubpackageKey()
Returns the subpackage key of the specified controller.
If there is no subpackage key set, the method returns NULL.
void
setControllerName(string $controllerName)
Sets the name of the controller which is supposed to handle the request.
Note: This is not the object name of the controller!
Examples: "Standard", "Account", ...
string
getControllerName()
Returns the object name of the controller supposed to handle this request, if one was set already (if not, the name of the default controller is returned)
void
setControllerActionName(string $actionName)
Sets the name of the action contained in this request.
Note that the action name must start with a lower case letter and is case sensitive.
string
getControllerActionName()
Returns the name of the action the controller is supposed to execute.
void
setArgument(string $argumentName, mixed $value)
Sets the value of the specified argument
string|array
getArgument(string $argumentName)
Returns the value of the specified argument
bool
hasArgument(string $argumentName)
Checks if an argument of the given name exists (is set)
void
setArguments(array $arguments)
Sets the specified arguments.
The arguments array will be reset therefore any arguments which existed before will be overwritten!
array
getArguments()
Returns an Array of arguments and their values
string|object
getInternalArgument(string $argumentName)
Returns the value of the specified internal argument.
Internal arguments are set via setArgument(). In order to be handled as an internal argument, its name must start with two underscores.
array
getInternalArguments()
Returns the internal arguments of the request, that is, all arguments whose name starts with two underscores.
void
setArgumentNamespace(string $namespace)
Sets a namespace for the arguments of this request.
This doesn't affect the actual behavior of argument handling within this classes' methods but is used in other parts of Flow and its libraries to render argument names which don't conflict with each other.
string
getArgumentNamespace()
Returns the argument namespace, if any.
array
getPluginArguments()
Returns an array of plugin argument configurations
void
setFormat(string $format)
Sets the requested representation format
string
getFormat()
Returns the requested representation format
protected void
emitRequestDispatched(ActionRequest $request)
Emits a signal when a Request has been dispatched
The action request is not proxyable, so the signal is dispatched manually here. The safeguard allows unit tests without the dispatcher dependency.
__clone()
Resets the dispatched status to false
array
__sleep()
We provide our own __sleep method, where we serialize all properties except the parentRequest if it is a HTTP request -- as this one contains $_SERVER etc.