‪TYPO3CMS  10.4
TYPO3\CMS\Extbase\Mvc\Controller\AbstractController Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Mvc\Controller\AbstractController:
TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface

Public Member Functions

 injectSignalSlotDispatcher (Dispatcher $signalSlotDispatcher)
 
 injectValidatorResolver (ValidatorResolver $validatorResolver)
 
ControllerContext getControllerContext ()
 
 injectConfigurationManager (ConfigurationManagerInterface $configurationManager)
 
 injectObjectManager (ObjectManagerInterface $objectManager)
 
 addFlashMessage ($messageBody, $messageTitle='', $severity=AbstractMessage::OK, $storeInSession=true)
 
bool canProcessRequest (RequestInterface $request)
 
 processRequest (RequestInterface $request, ResponseInterface $response)
 
 forward ($actionName, $controllerName=null, $extensionName=null, array $arguments=null)
 
 throwStatus ($statusCode, $statusMessage=null, $content=null)
 
 initializeControllerArgumentsBaseValidators ()
 

Protected Member Functions

TYPO3 CMS Extbase Mvc Controller ControllerContext buildControllerContext ()
 
 redirect ($actionName, $controllerName=null, $extensionName=null, array $arguments=null, $pageUid=null, $delay=0, $statusCode=303)
 
 redirectToUri ($uri, $delay=0, $statusCode=303)
 
string addBaseUriIfNecessary ($uri)
 
 mapRequestArgumentsToControllerArguments ()
 

Private Attributes

array $deprecatedPublicProperties
 
TYPO3 CMS Extbase SignalSlot Dispatcher $signalSlotDispatcher
 
TYPO3 CMS Extbase Object ObjectManagerInterface $objectManager
 
TYPO3 CMS Extbase Mvc Web Routing UriBuilder $uriBuilder
 
array $settings
 
TYPO3 CMS Extbase Mvc RequestInterface $request
 
TYPO3 CMS Extbase Mvc ResponseInterface $response
 
TYPO3 CMS Extbase Validation ValidatorResolver $validatorResolver
 
TYPO3 CMS Extbase Mvc Controller Arguments $arguments
 
array $supportedRequestTypes = array( \TYPO3\CMS\Extbase\Mvc\Request::class )
 
TYPO3 CMS Extbase Mvc Controller ControllerContext $controllerContext
 
ConfigurationManagerInterface $configurationManager
 

Detailed Description

An abstract base class for Controllers

Deprecated:
‪since TYPO3 10.2, will be removed in version 11.0

Definition at line 42 of file AbstractController.php.

Member Function Documentation

◆ addBaseUriIfNecessary()

string TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::addBaseUriIfNecessary (   $uri)
protected

Adds the base uri if not already in place.

Parameters
string$uri‪The URI
Returns
‪string
Deprecated:
‪since TYPO3 10.2 and will be removed in version 11.0

Definition at line 410 of file AbstractController.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\redirectToUri().

◆ addFlashMessage()

TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::addFlashMessage (   $messageBody,
  $messageTitle = '',
  $severity = AbstractMessage::OK,
  $storeInSession = true 
)

Creates a Message object and adds it to the FlashMessageQueue.

Parameters
string$messageBody‪The message
string$messageTitle‪Optional message title
int$severity‪Optional severity, must be one of \TYPO3\CMS\Core\Messaging\FlashMessage constants
bool$storeInSession‪Optional, defines whether the message should be stored in the session (default) or not
Exceptions

Definition at line 176 of file AbstractController.php.

◆ buildControllerContext()

TYPO3 CMS Extbase Mvc Controller ControllerContext TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::buildControllerContext ( )
protected

◆ canProcessRequest()

bool TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::canProcessRequest ( RequestInterface  $request)

Checks if the current request type is supported by the controller.

If your controller only supports certain request types, either replace / modify the supportedRequestTypes property or override this method.

Parameters
\TYPO3\CMS\Extbase\Mvc\RequestInterface$request‪The current request
Returns
‪bool TRUE if this request type is supported, otherwise FALSE
Deprecated:
‪since TYPO3 10.2 and will be removed in version 11.0

Implements TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface.

Definition at line 208 of file AbstractController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\$request.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\processRequest().

◆ forward()

TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::forward (   $actionName,
  $controllerName = null,
  $extensionName = null,
array  $arguments = null 
)

Forwards the request to another action and / or controller.

Request is directly transferred to the other action / controller without the need for a new request.

Parameters
string$actionName‪Name of the action to forward to
string | null$controllerName‪Unqualified object name of the controller to forward to. If not specified, the current controller is used.
string | null$extensionName‪Name of the extension containing the controller to forward to. If not specified, the current extension is assumed.
array | null$argumentsArguments to pass to the target action
Exceptions
StopActionException
See also
redirect()
Deprecated:
‪since TYPO3 10.2 and will be removed in version 11.0

Definition at line 293 of file AbstractController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\$arguments.

◆ getControllerContext()

ControllerContext TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::getControllerContext ( )

◆ initializeControllerArgumentsBaseValidators()

TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::initializeControllerArgumentsBaseValidators ( )

Collects the base validators which were defined for the data type of each controller argument and adds them to the argument's validator chain.

Deprecated:
‪since TYPO3 10.2 and will be removed in version 11.0

Definition at line 457 of file AbstractController.php.

References $validator.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\processRequest().

◆ injectConfigurationManager()

TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::injectConfigurationManager ( ConfigurationManagerInterface  $configurationManager)

◆ injectObjectManager()

TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::injectObjectManager ( ObjectManagerInterface  $objectManager)

Injects the object manager

Parameters
\TYPO3\CMS\Extbase\Object\ObjectManagerInterface$objectManager

Definition at line 159 of file AbstractController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\$objectManager, and TYPO3\CMS\Extbase\Object\ObjectManagerInterface\get().

◆ injectSignalSlotDispatcher()

TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::injectSignalSlotDispatcher ( Dispatcher  $signalSlotDispatcher)
Parameters
\TYPO3\CMS\Extbase\SignalSlot\Dispatcher$signalSlotDispatcher

Definition at line 103 of file AbstractController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\$signalSlotDispatcher.

◆ injectValidatorResolver()

TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::injectValidatorResolver ( ValidatorResolver  $validatorResolver)
Parameters
\TYPO3\CMS\Extbase\Validation\ValidatorResolver$validatorResolver

Definition at line 111 of file AbstractController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\$validatorResolver.

◆ mapRequestArgumentsToControllerArguments()

TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::mapRequestArgumentsToControllerArguments ( )
protected

Maps arguments delivered by the request object to the local controller arguments.

Exceptions
Exception

Definition at line 479 of file AbstractController.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\processRequest().

◆ processRequest()

TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::processRequest ( RequestInterface  $request,
ResponseInterface  $response 
)

Processes a general request. The result can be returned by altering the given response.

Parameters
\TYPO3\CMS\Extbase\Mvc\RequestInterface$request‪The request object
\TYPO3\CMS\Extbase\Mvc\ResponseInterface$response‪The response, modified by this handler
Exceptions
UnsupportedRequestTypeException‪if the controller doesn't support the current request type
Deprecated:
‪since TYPO3 10.2 and will be removed in version 11.0

Implements TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface.

Definition at line 231 of file AbstractController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\$request, TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\$response, TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\buildControllerContext(), TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\canProcessRequest(), TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\initializeControllerArgumentsBaseValidators(), TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\mapRequestArgumentsToControllerArguments(), and TYPO3\CMS\Extbase\Mvc\RequestInterface\setDispatched().

◆ redirect()

TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::redirect (   $actionName,
  $controllerName = null,
  $extensionName = null,
array  $arguments = null,
  $pageUid = null,
  $delay = 0,
  $statusCode = 303 
)
protected

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 thrown an exception if used with other request types.

Parameters
string$actionName‪Name of the action to forward to
string | null$controllerName‪Unqualified object name of the controller to forward to. If not specified, the current controller is used.
string | null$extensionName‪Name of the extension containing the controller to forward to. If not specified, the current extension is assumed.
array | null$argumentsArguments to pass to the target action
int | null$pageUid‪Target page uid. If NULL, the current page uid is used
int$delay‪(optional) The delay in seconds. Default is no delay.
int$statusCode‪(optional) The HTTP status code for the redirect. Default is "303 See Other
Exceptions
UnsupportedRequestTypeException‪If the request is not a web request
StopActionException
See also
forward()
Deprecated:
‪since TYPO3 10.2 and will be removed in version 11.0

Definition at line 336 of file AbstractController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\$arguments, TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger(), and TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\redirectToUri().

◆ redirectToUri()

TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::redirectToUri (   $uri,
  $delay = 0,
  $statusCode = 303 
)
protected

Redirects the web request to another uri.

NOTE: This method only supports web requests and will thrown an exception if used with other request types.

Parameters
mixed$uri‪A string representation of a URI
int$delay‪(optional) The delay in seconds. Default is no delay.
int$statusCode‪(optional) The HTTP status code for the redirect. Default is "303 See Other
Exceptions
UnsupportedRequestTypeException‪If the request is not a web request
StopActionException
Deprecated:
‪since TYPO3 10.2 and will be removed in version 11.0

Definition at line 372 of file AbstractController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\addBaseUriIfNecessary(), and TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\OBJECTTYPE_USER.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\redirect().

◆ throwStatus()

TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::throwStatus (   $statusCode,
  $statusMessage = null,
  $content = null 
)

Sends the specified HTTP status immediately.

NOTE: This method only supports web requests and will thrown an exception if used with other request types.

Parameters
int$statusCode‪The HTTP status code
string$statusMessage‪A custom HTTP status message
string$content‪Body content which further explains the status
Exceptions
UnsupportedRequestTypeException‪If the request is not a web request
StopActionException
Deprecated:
‪since TYPO3 10.2 and will be removed in version 11.0

Definition at line 432 of file AbstractController.php.

Member Data Documentation

◆ $arguments

TYPO3 CMS Extbase Mvc Controller Arguments TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::$arguments
private

◆ $configurationManager

ConfigurationManagerInterface TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::$configurationManager
private

◆ $controllerContext

TYPO3 CMS Extbase Mvc Controller ControllerContext TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::$controllerContext
private

◆ $deprecatedPublicProperties

array TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::$deprecatedPublicProperties
private
Initial value:
= array(
'signalSlotDispatcher' => 'Property ' . self::class . '::$signalSlotDispatcher is deprecated since TYPO3 10.2 and will be removed in TYPO3 11.0',
'objectManager' => 'Property ' . self::class . '::$objectManager is deprecated since TYPO3 10.2 and will be removed in TYPO3 11.0',
'uriBuilder' => 'Property ' . self::class . '::$uriBuilder is deprecated since TYPO3 10.2 and will be removed in TYPO3 11.0',
'settings' => 'Property ' . self::class . '::$settings is deprecated since TYPO3 10.2 and will be removed in TYPO3 11.0',
'request' => 'Property ' . self::class . '::$request is deprecated since TYPO3 10.2 and will be removed in TYPO3 11.0',
'response' => 'Property ' . self::class . '::$response is deprecated since TYPO3 10.2 and will be removed in TYPO3 11.0',
'arguments' => 'Property ' . self::class . '::$arguments is deprecated since TYPO3 10.2 and will be removed in TYPO3 11.0',
'validatorResolver' => 'Property ' . self::class . '::$validatorResolver is deprecated since TYPO3 10.2 and will be removed in TYPO3 11.0',
'supportedRequestTypes' => 'Property ' . self::class . '::$supportedRequestTypes is deprecated since TYPO3 10.2 and will be removed in TYPO3 11.0',
'controllerContext' => 'Property ' . self::class . '::$controllerContext is deprecated since TYPO3 10.2 and will be removed in TYPO3 11.0',
'configurationManager' => 'Property ' . self::class . '::$configurationManager is deprecated since TYPO3 10.2 and will be removed in TYPO3 11.0',
)

Definition at line 48 of file AbstractController.php.

◆ $objectManager

TYPO3 CMS Extbase Object ObjectManagerInterface TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::$objectManager
private

◆ $request

TYPO3 CMS Extbase Mvc RequestInterface TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::$request
private

◆ $response

TYPO3 CMS Extbase Mvc ResponseInterface TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::$response
private

The response which will be returned by this action controller

Definition at line 90 of file AbstractController.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\processRequest().

◆ $settings

array TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::$settings
private

Contains the settings of the current extension

Definition at line 78 of file AbstractController.php.

◆ $signalSlotDispatcher

TYPO3 CMS Extbase SignalSlot Dispatcher TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::$signalSlotDispatcher
private

◆ $supportedRequestTypes

array TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::$supportedRequestTypes = array( \TYPO3\CMS\Extbase\Mvc\Request::class )
private

An array of supported request types. By default only web requests are supported. Modify or replace this array if your specific controller supports certain (additional) request types.

Definition at line 122 of file AbstractController.php.

◆ $uriBuilder

TYPO3 CMS Extbase Mvc Web Routing UriBuilder TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::$uriBuilder
private

Definition at line 72 of file AbstractController.php.

◆ $validatorResolver

TYPO3 CMS Extbase Validation ValidatorResolver TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::$validatorResolver
private