‪TYPO3CMS  9.5
TYPO3\CMS\Extbase\Mvc\Controller\ActionController Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Mvc\Controller\ActionController:
TYPO3\CMS\Extbase\Mvc\Controller\AbstractController TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface ExtbaseTeam\BlogExample\Controller\BlogController ExtbaseTeam\BlogExample\Controller\ContentController OliverHader\IrreTutorial\Controller\AbstractController TYPO3\CMS\Belog\Controller\BackendLogController TYPO3\CMS\Beuser\Controller\BackendUserController TYPO3\CMS\Beuser\Controller\BackendUserGroupController TYPO3\CMS\Beuser\Controller\PermissionController TYPO3\CMS\Extbase\Tests\Functional\Mvc\Controller\Fixture\Controller\ArgumentTestController TYPO3\CMS\Extbase\Tests\Functional\Mvc\Controller\Fixture\Controller\TestController TYPO3\CMS\Extbase\Tests\Functional\Validation\Fixture\Controller\TestController TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\DummyController TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\DummyControllerWithValidateAnnotationWithoutParam TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\DummyControllerWithValidateAnnotationWithoutParamTypeHint TYPO3\CMS\Extbase\Tests\UnitDeprecated\Reflection\Fixture\DummyControllerWithValidateAnnotations TYPO3\CMS\Extbase\Tests\UnitDeprecated\Reflection\Fixture\DummyControllerWithValidateAnnotationWithoutParam TYPO3\CMS\Extbase\Tests\UnitDeprecated\Reflection\Fixture\DummyControllerWithValidateAnnotationWithoutParamTypeHint TYPO3\CMS\Extensionmanager\Controller\AbstractController TYPO3\CMS\Filelist\Controller\FileListController TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetController TYPO3\CMS\Form\Controller\AbstractBackendController TYPO3\CMS\Form\Controller\FormFrontendController TYPO3\CMS\IndexedSearch\Controller\AdministrationController TYPO3\CMS\IndexedSearch\Controller\SearchController TYPO3\CMS\Workspaces\Controller\ReviewController TYPO3Fluid\FluidTest\Controller\TemplateController

Public Member Functions

 injectReflectionService (\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService)
 
 injectCacheService (\TYPO3\CMS\Extbase\Service\CacheService $cacheService)
 
 injectMvcPropertyMappingConfigurationService (\TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService $mvcPropertyMappingConfigurationService)
 
 processRequest (\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Extbase\Mvc\Controller\AbstractController
 injectSignalSlotDispatcher (\TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher)
 
 injectValidatorResolver (\TYPO3\CMS\Extbase\Validation\ValidatorResolver $validatorResolver)
 
ControllerContext getControllerContext ()
 
 __construct ()
 
 injectConfigurationManager (ConfigurationManagerInterface $configurationManager)
 
 injectObjectManager (\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
 
 addFlashMessage ($messageBody, $messageTitle='', $severity=\TYPO3\CMS\Core\Messaging\AbstractMessage::OK, $storeInSession=true)
 
bool canProcessRequest (\TYPO3\CMS\Extbase\Mvc\RequestInterface $request)
 
 forward ($actionName, $controllerName=null, $extensionName=null, array $arguments=null)
 
 throwStatus ($statusCode, $statusMessage=null, $content=null)
 
 initializeControllerArgumentsBaseValidators ()
 

Static Public Member Functions

static array getActionMethodParameters ($objectManager)
 

Protected Member Functions

 renderAssetsForRequest ($request)
 
 initializeActionMethodArguments ()
 
 initializeActionMethodValidators ()
 
string resolveActionMethodName ()
 
 callActionMethod ()
 
 emitBeforeCallActionMethodSignal (array $preparedArguments)
 
ViewInterface resolveView ()
 
 setViewConfiguration (ViewInterface $view)
 
array getViewProperty ($extbaseFrameworkConfiguration, $setting)
 
mixed resolveViewObjectName ()
 
 initializeView (ViewInterface $view)
 
 initializeAction ()
 
string errorAction ()
 
 clearCacheOnError ()
 
 addErrorFlashMessage ()
 
string getErrorFlashMessage ()
 
 forwardToReferringRequest ()
 
string getFlattenedValidationErrorMessage ()
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Extbase\Mvc\Controller\AbstractController
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 ()
 

Protected Attributes

TYPO3 CMS Extbase Reflection ReflectionService $reflectionService
 
TYPO3 CMS Extbase Service CacheService $cacheService
 
ViewInterface $view
 
string $namespacesViewObjectNamePattern = '@vendor\@extension\View\@controller\@action@format'
 
array $viewFormatToObjectNameMap = array( )
 
string $defaultViewObjectName = \TYPO3\CMS\Fluid\View\TemplateView::class
 
string $actionMethodName = 'indexAction'
 
string $errorMethodName = 'errorAction'
 
TYPO3 CMS Extbase Mvc Controller MvcPropertyMappingConfigurationService $mvcPropertyMappingConfigurationService
 
TYPO3 CMS Extbase Mvc Request $request
 
TYPO3 CMS Extbase Mvc Response $response
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Extbase\Mvc\Controller\AbstractController
TYPO3 CMS Extbase SignalSlot Dispatcher $signalSlotDispatcher
 
TYPO3 CMS Extbase Object ObjectManagerInterface $objectManager
 
TYPO3 CMS Extbase Mvc Web Routing UriBuilder $uriBuilder
 
string $extensionName
 
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

A multi action controller. This is by far the most common base class for Controllers.

Definition at line 30 of file ActionController.php.

Member Function Documentation

◆ addErrorFlashMessage()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::addErrorFlashMessage ( )
protected

◆ callActionMethod()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::callActionMethod ( )
protected

Calls the specified action method and passes the arguments.

If the action returns a string, it is appended to the content in the response object. If the action doesn't return anything and a valid view exists, the view is rendered automatically.

Definition at line 297 of file ActionController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\ActionController\emitBeforeCallActionMethodSignal().

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

◆ clearCacheOnError()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::clearCacheOnError ( )
protected

Clear cache of current page on error. Needed because we want a re-evaluation of the data. Better would be just do delete the cache for the error action, but that is not possible right now.

Definition at line 524 of file ActionController.php.

References $GLOBALS, and TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface\CONFIGURATION_TYPE_FRAMEWORK.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\ActionController\errorAction().

◆ emitBeforeCallActionMethodSignal()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::emitBeforeCallActionMethodSignal ( array  $preparedArguments)
protected

Emits a signal before the current action is called

Parameters
array$preparedArguments

Definition at line 326 of file ActionController.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\ActionController\callActionMethod().

◆ errorAction()

string TYPO3\CMS\Extbase\Mvc\Controller\ActionController::errorAction ( )
protected

A special action which is called if the originally intended action could not be called, for example if the arguments were not valid.

The default implementation sets a flash message, request errors and forwards back to the originating action. This is suitable for most actions dealing with form input.

We clear the page cache by default on an error as well, as we need to make sure the data is re-evaluated when the user changes something.

Returns
‪string

Definition at line 511 of file ActionController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\ActionController\addErrorFlashMessage(), TYPO3\CMS\Extbase\Mvc\Controller\ActionController\clearCacheOnError(), TYPO3\CMS\Extbase\Mvc\Controller\ActionController\forwardToReferringRequest(), and TYPO3\CMS\Extbase\Mvc\Controller\ActionController\getFlattenedValidationErrorMessage().

◆ forwardToReferringRequest()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::forwardToReferringRequest ( )
protected

If information on the request before the current request was sent, this method forwards back to the originating request. This effectively ends processing of the current request, so do not call this method before you have finished the necessary business logic!

Exceptions
StopActionException

Definition at line 566 of file ActionController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$request, and TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\forward().

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\ActionController\errorAction().

◆ getActionMethodParameters()

static array TYPO3\CMS\Extbase\Mvc\Controller\ActionController::getActionMethodParameters (   $objectManager)
static

Returns a map of action method names and their parameters.

Parameters
\TYPO3\CMS\Extbase\Object\ObjectManagerInterface$objectManager
Returns
‪array Array of method parameters by action name
Deprecated:
‪since TYPO3 v9, will be removed in TYPO3 v10.0.

Definition at line 603 of file ActionController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\$objectManager, TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$reflectionService, TYPO3\CMS\Extbase\Object\ObjectManagerInterface\get(), and TYPO3\CMS\Extbase\Reflection\ReflectionService\getMethodParameters().

◆ getErrorFlashMessage()

string TYPO3\CMS\Extbase\Mvc\Controller\ActionController::getErrorFlashMessage ( )
protected

A template method for displaying custom error flash messages, or to display no flash message at all on errors. Override this to customize the flash message in your action controller.

Returns
‪string The flash message or FALSE if no flash message should be set

Reimplemented in ExtbaseTeam\BlogExample\Controller\BlogController.

Definition at line 554 of file ActionController.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\ActionController\addErrorFlashMessage().

◆ getFlattenedValidationErrorMessage()

string TYPO3\CMS\Extbase\Mvc\Controller\ActionController::getFlattenedValidationErrorMessage ( )
protected

Returns a string with a basic error message about validation failure. We may add all validation error messages to a log file in the future, but for security reasons (

See also
‪#54074) we do not return these here.
Returns
‪string

Definition at line 589 of file ActionController.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\ActionController\errorAction().

◆ getViewProperty()

array TYPO3\CMS\Extbase\Mvc\Controller\ActionController::getViewProperty (   $extbaseFrameworkConfiguration,
  $setting 
)
protected

Handles the path resolving for *rootPath(s)

numerical arrays get ordered by key ascending

Parameters
array$extbaseFrameworkConfiguration
string$setting‪parameter name from TypoScript
Returns
‪array

Definition at line 426 of file ActionController.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\ActionController\setViewConfiguration().

◆ initializeAction()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::initializeAction ( )
protected

◆ initializeActionMethodArguments()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::initializeActionMethodArguments ( )
protected

Implementation of the arguments initilization in the action controller: Automatically registers arguments of the current action

Don't override this method - use initializeAction() instead.

Exceptions

Definition at line 205 of file ActionController.php.

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

◆ initializeActionMethodValidators()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::initializeActionMethodValidators ( )
protected

Adds the needed validators to the Arguments:

  • ‪Validators checking the data type from the
    Parameters
    annotation
  • ‪Custom validators specified with validate annotations.
  • ‪Model-based validators (validate annotations in the model)
  • ‪Custom model validator classes

Definition at line 234 of file ActionController.php.

References $validator.

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

◆ initializeView()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::initializeView ( ViewInterface  $view)
protected

◆ injectCacheService()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::injectCacheService ( \TYPO3\CMS\Extbase\Service\CacheService  $cacheService)
Parameters
\TYPO3\CMS\Extbase\Service\CacheService$cacheService

Definition at line 106 of file ActionController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$cacheService.

◆ injectMvcPropertyMappingConfigurationService()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::injectMvcPropertyMappingConfigurationService ( \TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService  $mvcPropertyMappingConfigurationService)
Parameters
\TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService$mvcPropertyMappingConfigurationService

Definition at line 114 of file ActionController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$mvcPropertyMappingConfigurationService.

◆ injectReflectionService()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::injectReflectionService ( \TYPO3\CMS\Extbase\Reflection\ReflectionService  $reflectionService)
Parameters
\TYPO3\CMS\Extbase\Reflection\ReflectionService$reflectionService

Definition at line 98 of file ActionController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$reflectionService.

◆ processRequest()

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

Handles a request. The result output is 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

Reimplemented from TYPO3\CMS\Extbase\Mvc\Controller\AbstractController.

Definition at line 127 of file ActionController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$request, TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$response, TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\buildControllerContext(), TYPO3\CMS\Extbase\Mvc\Controller\ActionController\callActionMethod(), TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\canProcessRequest(), TYPO3\CMS\Extbase\Mvc\Controller\ActionController\initializeAction(), TYPO3\CMS\Extbase\Mvc\Controller\ActionController\initializeActionMethodArguments(), TYPO3\CMS\Extbase\Mvc\Controller\ActionController\initializeActionMethodValidators(), TYPO3\CMS\Extbase\Mvc\Controller\ActionController\initializeView(), TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\mapRequestArgumentsToControllerArguments(), TYPO3\CMS\Extbase\Mvc\Controller\ActionController\renderAssetsForRequest(), TYPO3\CMS\Extbase\Mvc\Controller\ActionController\resolveActionMethodName(), TYPO3\CMS\Extbase\Mvc\Controller\ActionController\resolveView(), and TYPO3\CMS\Extbase\Mvc\Cli\Request\setDispatched().

Referenced by TYPO3\CMS\Extbase\Tests\Functional\Mvc\Controller\ActionControllerArgumentTest\dispatch().

◆ renderAssetsForRequest()

TYPO3\CMS\Extbase\Mvc\Controller\ActionController::renderAssetsForRequest (   $request)
protected

Method which initializes assets that should be attached to the response for the given $request, which contains parameters that an override can use to determine which assets to add via PageRenderer.

This default implementation will attempt to render the sections "HeaderAssets" and "FooterAssets" from the template that is being rendered, inserting the rendered content into either page header or footer, as appropriate. Both sections are optional and can be used one or both in combination.

You can add assets with this method without worrying about duplicates, if for example you do this in a plugin that gets used multiple time on a page.

Parameters
\TYPO3\CMS\Extbase\Mvc\RequestInterface$request

Definition at line 175 of file ActionController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\$arguments, and TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$request.

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

◆ resolveActionMethodName()

string TYPO3\CMS\Extbase\Mvc\Controller\ActionController::resolveActionMethodName ( )
protected

Resolves and checks the current action method name

Returns
‪string Method name of the current action
Exceptions

Definition at line 281 of file ActionController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$actionMethodName.

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

◆ resolveView()

◆ resolveViewObjectName()

mixed TYPO3\CMS\Extbase\Mvc\Controller\ActionController::resolveViewObjectName ( )
protected

Determines the fully qualified view object name.

Returns
‪mixed The fully qualified view object name or FALSE if no matching view could be found.

Definition at line 444 of file ActionController.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\ActionController\resolveView().

◆ setViewConfiguration()

Member Data Documentation

◆ $actionMethodName

string TYPO3\CMS\Extbase\Mvc\Controller\ActionController::$actionMethodName = 'indexAction'
protected

Name of the action method

Definition at line 71 of file ActionController.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\ActionController\resolveActionMethodName().

◆ $cacheService

TYPO3 CMS Extbase Service CacheService TYPO3\CMS\Extbase\Mvc\Controller\ActionController::$cacheService
protected

◆ $defaultViewObjectName

string TYPO3\CMS\Extbase\Mvc\Controller\ActionController::$defaultViewObjectName = \TYPO3\CMS\Fluid\View\TemplateView::class
protected

The default view object to use if none of the resolved views can render a response for the current request.

Definition at line 65 of file ActionController.php.

◆ $errorMethodName

string TYPO3\CMS\Extbase\Mvc\Controller\ActionController::$errorMethodName = 'errorAction'
protected

Name of the special error action method which is called in case of errors

Definition at line 77 of file ActionController.php.

◆ $mvcPropertyMappingConfigurationService

TYPO3 CMS Extbase Mvc Controller MvcPropertyMappingConfigurationService TYPO3\CMS\Extbase\Mvc\Controller\ActionController::$mvcPropertyMappingConfigurationService
protected

◆ $namespacesViewObjectNamePattern

string TYPO3\CMS\Extbase\Mvc\Controller\ActionController::$namespacesViewObjectNamePattern = '@vendor\@extension\View\@controller\@action@format'
protected

Definition at line 48 of file ActionController.php.

◆ $reflectionService

TYPO3 CMS Extbase Reflection ReflectionService TYPO3\CMS\Extbase\Mvc\Controller\ActionController::$reflectionService
protected

◆ $request

◆ $response

◆ $view

◆ $viewFormatToObjectNameMap

array TYPO3\CMS\Extbase\Mvc\Controller\ActionController::$viewFormatToObjectNameMap = array( )
protected

A list of formats and object names of the views which should render them.

Example:

array('html' => 'Tx_MyExtension_View_MyHtmlView', 'json' => 'F3...

Definition at line 58 of file ActionController.php.