‪TYPO3CMS  9.5
TYPO3\CMS\Extbase\Mvc\Controller\CommandController Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Mvc\Controller\CommandController:
TYPO3\CMS\Extbase\Mvc\Controller\CommandControllerInterface TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface Acme\Mypkg\Command\MockBCommandController Tx_Extbase_Command_MockCCommandController TYPO3\CMS\Extbase\Command\HelpCommandController TYPO3\CMS\Extbase\Tests\MockACommandController TYPO3\CMS\Extensionmanager\Command\ExtensionCommandController

Public Member Functions

 __construct ()
 
 injectObjectManager (ObjectManagerInterface $objectManager)
 
 injectReflectionService (ReflectionService $reflectionService)
 
bool canProcessRequest (\TYPO3\CMS\Extbase\Mvc\RequestInterface $request)
 
 processRequest (RequestInterface $request, ResponseInterface $response)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface
 processRequest (\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)
 

Protected Member Functions

string resolveCommandMethodName ()
 
 initializeCommandMethodArguments ()
 
 mapRequestArgumentsToControllerArguments ()
 
 initializeBackendAuthentication ()
 
 forward ($commandName, $controllerObjectName=null, array $arguments=[])
 
 callCommandMethod ()
 
 output ($text, array $arguments=[])
 
 outputLine ($text='', array $arguments=[])
 
 outputFormatted ($text='', array $arguments=[], $leftPadding=0)
 
 quit ($exitCode=0)
 
 sendAndExit ($exitCode=0)
 
BackendUserAuthentication null getBackendUserAuthentication ()
 

Protected Attributes

Request $request
 
Response $response
 
Arguments $arguments
 
string $commandMethodName = ''
 
bool $requestAdminPermissions = false
 
ReflectionService $reflectionService
 
ObjectManagerInterface $objectManager
 
ConsoleOutput $output
 

Detailed Description

A controller which processes requests from the command line

Deprecated:
‪since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.

Definition at line 36 of file CommandController.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::__construct ( )

Definition at line 74 of file CommandController.php.

Member Function Documentation

◆ callCommandMethod()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::callCommandMethod ( )
protected

Calls the specified command method and passes the arguments.

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

Definition at line 245 of file CommandController.php.

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

◆ canProcessRequest()

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

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

Parameters
\TYPO3\CMS\Extbase\Mvc\RequestInterface$request‪The current request
Returns
‪bool TRUE if this request type is supported, otherwise FALSE

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

Definition at line 101 of file CommandController.php.

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

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

◆ forward()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::forward (   $commandName,
  $controllerObjectName = null,
array  $arguments = [] 
)
protected

Forwards the request to another command and / or CommandController.

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

Parameters
string$commandName
string$controllerObjectName
array$arguments
Exceptions
StopActionException

Definition at line 225 of file CommandController.php.

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

◆ getBackendUserAuthentication()

BackendUserAuthentication null TYPO3\CMS\Extbase\Mvc\Controller\CommandController::getBackendUserAuthentication ( )
protected

Returns the global BackendUserAuthentication object.

Returns
‪BackendUserAuthentication|null

Definition at line 329 of file CommandController.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\CommandController\initializeBackendAuthentication().

◆ initializeBackendAuthentication()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::initializeBackendAuthentication ( )
protected

◆ initializeCommandMethodArguments()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::initializeCommandMethodArguments ( )
protected

Initializes the arguments array of this controller by creating an empty argument object for each of the method arguments found in the designated command method.

Exceptions

Definition at line 158 of file CommandController.php.

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

◆ injectObjectManager()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::injectObjectManager ( ObjectManagerInterface  $objectManager)
Parameters
\TYPO3\CMS\Extbase\Object\ObjectManagerInterface$objectManager

Definition at line 82 of file CommandController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\CommandController\$objectManager.

◆ injectReflectionService()

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

Definition at line 90 of file CommandController.php.

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

◆ mapRequestArgumentsToControllerArguments()

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

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

Definition at line 182 of file CommandController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\CommandController\output().

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

◆ output()

◆ outputFormatted()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::outputFormatted (   $text = '',
array  $arguments = [],
  $leftPadding = 0 
)
protected

Formats the given text to fit into MAXIMUM_LINE_LENGTH and outputs it to the console window

Parameters
string$text‪Text to output
array$arguments‪Optional arguments to use for sprintf
int$leftPadding‪The number of spaces to use for indentation
See also
outputLine()

Definition at line 294 of file CommandController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\CommandController\$arguments, and TYPO3\CMS\Extbase\Mvc\Controller\CommandController\output().

◆ outputLine()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::outputLine (   $text = '',
array  $arguments = [] 
)
protected

◆ processRequest()

◆ quit()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::quit (   $exitCode = 0)
protected

Exits the CLI through the dispatcher An exit status code can be specified

See also
http://www.php.net/exit
Parameters
int$exitCode‪Exit code to return on exit
Exceptions
StopActionException

Definition at line 306 of file CommandController.php.

Referenced by TYPO3\CMS\Extensionmanager\Command\ExtensionCommandController\dumpClassLoadingInformationCommand().

◆ resolveCommandMethodName()

string TYPO3\CMS\Extbase\Mvc\Controller\CommandController::resolveCommandMethodName ( )
protected

Resolves and checks the current command method name

Note: The resulting command method name might not have the correct case, which isn't a problem because PHP is case insensitive regarding method names.

Exceptions

Definition at line 142 of file CommandController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\CommandController\$commandMethodName.

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

◆ sendAndExit()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::sendAndExit (   $exitCode = 0)
protected

Sends the response and exits the CLI without any further code execution Should be used for commands that flush code caches.

Parameters
int$exitCode‪Exit code to return on exit

Definition at line 318 of file CommandController.php.

Member Data Documentation

◆ $arguments

◆ $commandMethodName

string TYPO3\CMS\Extbase\Mvc\Controller\CommandController::$commandMethodName = ''
protected

Name of the command method

Definition at line 54 of file CommandController.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\CommandController\resolveCommandMethodName().

◆ $objectManager

ObjectManagerInterface TYPO3\CMS\Extbase\Mvc\Controller\CommandController::$objectManager
protected

◆ $output

ConsoleOutput TYPO3\CMS\Extbase\Mvc\Controller\CommandController::$output
protected

Definition at line 72 of file CommandController.php.

◆ $reflectionService

ReflectionService TYPO3\CMS\Extbase\Mvc\Controller\CommandController::$reflectionService
protected

◆ $request

Request TYPO3\CMS\Extbase\Mvc\Controller\CommandController::$request
protected

◆ $requestAdminPermissions

bool TYPO3\CMS\Extbase\Mvc\Controller\CommandController::$requestAdminPermissions = false
protected

Whether the command needs admin access to perform its job

Definition at line 60 of file CommandController.php.

◆ $response

Response TYPO3\CMS\Extbase\Mvc\Controller\CommandController::$response
protected