Controller.php
42 * | _out_ `success` | Boolean whether the action completed successfully or not (depends on existence of error messages)
95 * Initialize the Controller with request/response data. Which data is required is defined by the Controller.
96 * The base class method just stores the parameters in a member variable. Specialized Controllers may override
98 * @attention It lies in its responsibility to fail or do some default action if some data is missing.
99 * @param $request Request instance sent to the Controller. The sender attribute of the Request is the
100 * last controller's name, the context is the current context and the action is the requested one.
101 * All data sent from the last controller are accessible using the Request::getValue method. The request is
103 * @param $response Response instance that will be modified by the Controller. The initial values for
104 * context and action are the same as in the request parameter and are meant to be modified according to the
105 * performed action. The sender attribute of the response is set to the current controller. Initially there
397 * @param $refresh Boolean indicating whether an existing token should be invalidated or reused (optional, default: _true_)
execute($method=null)
Execute the Controller resulting in its action processed.
Definition: Controller.php:132
Session is the interface for session implementations and defines access to session variables.
Definition: Session.php:19
setSender($sender)
Set the name of the sending Controller.
Response holds the response values that are used as output from Controller instances.
Definition: Response.php:20
Request holds the request values that are used as input to Controller instances.
Definition: Request.php:18
const CSRF_TOKEN_PARAM
Definition: Controller.php:51
executeSubAction($action)
Delegate the current request to another action.
Definition: Controller.php:211
static fromException(\Exception $ex)
Factory method for transforming an exception into an ApplicationError instance.
Definition: ApplicationError.php:172
initialize(Request $request, Response $response)
Initialize the Controller with request/response data.
Definition: Controller.php:108
getLocalSessionValue($key, $default=null)
Set the value of a local session variable.
Definition: Controller.php:443
const LEVEL_WARNING
Definition: ApplicationError.php:44
generateCsrfToken($name, $refresh=true)
Create a CSRF token, store it in the session and set it in the response.
Definition: Controller.php:399
requireTransaction()
Start or join a transaction that will be committed at the end of execution.
Definition: Controller.php:334
Implementations of Configuration give access to the application configuration.
Definition: Configuration.php:32
redirect($location, $key=null, $data=null)
Redirect to the given location with the given request data externally (HTTP status code 302).
Definition: Controller.php:236
setLocalSessionValue($key, $value)
Get the value of a local session variable.
Definition: Controller.php:454
ApplicationError is used to signal errors that occur while processing a request.
Definition: ApplicationError.php:41
static get($code, $data=null)
Factory method for retrieving a predefined error instance.
Definition: ApplicationError.php:144
PersistenceFacade defines the interface for PersistenceFacade implementations.
Definition: PersistenceFacade.php:23
ApplicationException signals a general application exception.
Definition: ApplicationException.php:22
doExecute($method=null)
Execute the given controller method.
static getNewInstance($name, $dynamicConfiguration=[])
Definition: ObjectFactory.php:55
__construct(Session $session, PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ActionMapper $actionMapper, Localization $localization, Message $message, Configuration $configuration)
Constructor.
Definition: Controller.php:77
Controller is the base class of all controllers.
Definition: Controller.php:49
ActionMapper implementations are responsible for instantiating and executing Controllers based on the...
Definition: ActionMapper.php:21
PermissionManager implementations are used to handle all authorization requests.
Definition: PermissionManager.php:20
LogManager is used to retrieve Logger instances.
Definition: LogManager.php:20
ObjectFactory implements the service locator pattern by wrapping a Factory instance and providing sta...
Definition: ObjectFactory.php:24
validateCsrfToken($name, $invalidate=true)
Validate the CSRF token contained in the request against the token stored in the session.
Definition: Controller.php:420
Localization defines the interface for storing localized entity instances and retrieving them back.
Definition: Localization.php:32
checkLanguageParameter()
Checks the language request parameter and adds an response error, if it is not contained in the Local...
Definition: Controller.php:381
Message is used to get localized messages to be used in the user interface.
Definition: Message.php:23