TYPO3 CMS  TYPO3_6-2
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 Tx_Extbase_MVC_Controller_CommandController TYPO3\CMS\Extbase\Command\HelpCommandController TYPO3\CMS\Extbase\Tests\MockACommandController TYPO3\CMS\Extensionmanager\Command\ExtensionCommandController TYPO3\CMS\Lang\Command\LanguageCommandController Tx_Extbase_Command_HelpCommandController

Public Member Functions

 injectObjectManager (\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
 
 canProcessRequest (\TYPO3\CMS\Extbase\Mvc\RequestInterface $request)
 
 processRequest (\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)
 

Public Attributes

const MAXIMUM_LINE_LENGTH = 79
 

Protected Member Functions

 resolveCommandMethodName ()
 
 initializeCommandMethodArguments ()
 
 mapRequestArgumentsToControllerArguments ()
 
 forward ($commandName, $controllerObjectName=NULL, array $arguments=array())
 
 callCommandMethod ()
 
 ensureAdminRoleIfRequested ()
 
 restoreUserRole ($originalRole)
 
 output ($text, array $arguments=array())
 
 outputLine ($text='', array $arguments=array())
 
 quit ($exitCode=0)
 
 sendAndExit ($exitCode=0)
 

Protected Attributes

 $request
 
 $response
 
 $arguments
 
 $commandMethodName = ''
 
 $requestAdminPermissions = FALSE
 
 $userAuthentication
 
 $reflectionService
 
 $objectManager
 

Detailed Description

A controller which processes requests from the command line

http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later

Definition at line 23 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.

Returns
void

Definition at line 206 of file CommandController.php.

References TYPO3\CMS\Extbase\Mvc\Controller\CommandController\ensureAdminRoleIfRequested(), and TYPO3\CMS\Extbase\Mvc\Controller\CommandController\restoreUserRole().

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

◆ canProcessRequest()

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$requestThe current request
Returns
boolean TRUE if this request type is supported, otherwise FALSE

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

Definition at line 89 of file CommandController.php.

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

◆ ensureAdminRoleIfRequested()

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

Set admin permissions for currently authenticated user if requested and returns the original state or NULL

Returns
NULL|int

Definition at line 227 of file CommandController.php.

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

◆ forward()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::forward (   $commandName,
  $controllerObjectName = NULL,
array  $arguments = array() 
)
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

Definition at line 186 of file CommandController.php.

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

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

◆ 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 139 of file CommandController.php.

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

◆ injectObjectManager()

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

Definition at line 77 of file CommandController.php.

References $GLOBALS, and TYPO3\CMS\Extbase\Mvc\Controller\CommandController\$objectManager.

◆ mapRequestArgumentsToControllerArguments()

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

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

Returns
void

Definition at line 161 of file CommandController.php.

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

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

◆ output()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::output (   $text,
array  $arguments = array() 
)
protected

Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf

See also
http://www.php.net/sprintf
Parameters
string$textText to output
array$argumentsOptional arguments to use for sprintf
Returns
void

Definition at line 256 of file CommandController.php.

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

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

◆ outputLine()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::outputLine (   $text = '',
array  $arguments = array() 
)
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
integer$exitCodeExit code to return on exit
Exceptions

Definition at line 283 of file CommandController.php.

◆ resolveCommandMethodName()

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 124 of file CommandController.php.

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

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

◆ restoreUserRole()

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::restoreUserRole (   $originalRole)
protected

Restores the original user role

Parameters
NULL | int$originalRole

Definition at line 241 of file CommandController.php.

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

◆ 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
integer$exitCodeExit code to return on exit
Returns
void

Definition at line 295 of file CommandController.php.

References die.

Member Data Documentation

◆ $arguments

◆ $commandMethodName

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

◆ $objectManager

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

◆ $reflectionService

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

Definition at line 66 of file CommandController.php.

◆ $request

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

◆ $requestAdminPermissions

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

Definition at line 55 of file CommandController.php.

◆ $response

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

◆ $userAuthentication

TYPO3\CMS\Extbase\Mvc\Controller\CommandController::$userAuthentication
protected

Definition at line 60 of file CommandController.php.

◆ MAXIMUM_LINE_LENGTH

const TYPO3\CMS\Extbase\Mvc\Controller\CommandController::MAXIMUM_LINE_LENGTH = 79

Definition at line 25 of file CommandController.php.