class CoreCommandController extends CommandController (View source)

Command controller for core commands

NOTE: This command controller will run in compile time (as defined in the package bootstrap)

Properties

protected Request $request from  CommandController
protected Response $response from  CommandController
protected Arguments $arguments from  CommandController
protected string $commandMethodName

Name of the command method

from  CommandController
protected ObjectManagerInterface $objectManager from  CommandController
protected CommandManager $commandManager from  CommandController
protected ConsoleOutput $output from  CommandController
protected RequestBuilder $requestBuilder
protected Dispatcher $dispatcher
protected Dispatcher $signalSlotDispatcher
protected Bootstrap $bootstrap
protected CacheManager $cacheManager
protected Compiler $proxyClassCompiler
protected ProxyClassBuilder $aopProxyClassBuilder
protected ProxyClassBuilder $dependencyInjectionProxyClassBuilder
protected Environment $environment

Methods

__construct()

Constructs the command controller

void
injectCommandManager(CommandManager $commandManager)

No description

void
injectObjectManager(ObjectManagerInterface $objectManager)

Injects the reflection service

void
processRequest(Request $request, Response $response)

Processes a command line request.

string
resolveCommandMethodName()

Resolves and checks the current command method name

void
initializeCommandMethodArguments()

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.

void
mapRequestArgumentsToControllerArguments()

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

void
forward(string $commandName, string $controllerObjectName = null, array $arguments = [])

Forwards the request to another command and / or CommandController.

void
callCommandMethod()

Calls the specified command method and passes the arguments.

string
getFlowInvocationString()

Returns the CLI Flow command depending on the environment

void
output(string $text, array $arguments = [])

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

void
outputLine(string $text = '', array $arguments = [])

Outputs specified text to the console window and appends a line break

void
outputFormatted(string $text = '', array $arguments = [], int $leftPadding = 0)

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

never
quit(int $exitCode = 0)

Exits the CLI through the dispatcher and makes sure that Flow is properly shut down.

never
sendAndExit(int $exitCode = 0)

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

void
injectRequestBuilder(RequestBuilder $requestBuilder)

No description

void
injectDispatcher(Dispatcher $dispatcher)

No description

void
injectSignalSlotDispatcher(Dispatcher $signalSlotDispatcher)

No description

void
injectBootstrap(Bootstrap $bootstrap)

No description

void
injectCacheManager(CacheManager $cacheManager)

No description

void
injectProxyClassCompiler(Compiler $proxyClassCompiler)

No description

void
injectAopProxyClassBuilder(ProxyClassBuilder $aopProxyClassBuilder)

No description

void
injectDependencyInjectionProxyClassBuilder(ProxyClassBuilder $dependencyInjectionProxyClassBuilder)

No description

void
injectEnvironment(Environment $environment)

No description

void
compileCommand(bool $force = false)

Explicitly compile proxy classes

void
setFilePermissionsCommand(string $commandlineUser, string $webserverUser, string $webserverGroup)

Adjust file permissions for CLI and web server access

void
migrateCommand(string $package, bool $status = false, string $packagesPath = null, string $version = null, bool $verbose = false, bool $force = false)

Migrate source files as needed

void
emitFinishedCompilationRun(int $classCount)

Signals that the compile command was successfully finished.

Details

__construct()

Constructs the command controller

void injectCommandManager(CommandManager $commandManager)

No description

Parameters

CommandManager $commandManager

Return Value

void

void injectObjectManager(ObjectManagerInterface $objectManager)

Injects the reflection service

Parameters

ObjectManagerInterface $objectManager

Return Value

void

void processRequest(Request $request, Response $response)

Processes a command line request.

Parameters

Request $request

The request object

Response $response

The response, modified by the controller

Return Value

void

Exceptions

InvalidArgumentTypeException
NoSuchCommandException

protected string resolveCommandMethodName()

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.

Return Value

string

Method name of the current command

Exceptions

NoSuchCommandException

protected void initializeCommandMethodArguments()

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.

Return Value

void

Exceptions

InvalidArgumentTypeException

protected void mapRequestArgumentsToControllerArguments()

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

Return Value

void

protected void forward(string $commandName, string $controllerObjectName = null, array $arguments = [])

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

Return Value

void

Exceptions

StopCommandException

protected void callCommandMethod()

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.

Return Value

void

string getFlowInvocationString()

Returns the CLI Flow command depending on the environment

Return Value

string

protected void output(string $text, array $arguments = [])

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

Parameters

string $text

Text to output

array $arguments

Optional arguments to use for sprintf

Return Value

void

See also

http://www.php.net/sprintf

protected void outputLine(string $text = '', array $arguments = [])

Outputs specified text to the console window and appends a line break

Parameters

string $text

Text to output

array $arguments

Optional arguments to use for sprintf

Return Value

void

See also

output()
outputLines()

protected void outputFormatted(string $text = '', array $arguments = [], int $leftPadding = 0)

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

Return Value

void

See also

outputLine()

protected never quit(int $exitCode = 0)

Exits the CLI through the dispatcher and makes sure that Flow is properly shut down.

If your command relies on functionality which is triggered through the Bootstrap shutdown (such as the persistence framework), you must use quit() instead of exit().

Parameters

int $exitCode

Exit code to return on exit (see http://www.php.net/exit)

Return Value

never

Exceptions

StopCommandException

protected never sendAndExit(int $exitCode = 0)

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

Return Value

never

void injectRequestBuilder(RequestBuilder $requestBuilder)

No description

Parameters

RequestBuilder $requestBuilder

Return Value

void

void injectDispatcher(Dispatcher $dispatcher)

No description

Parameters

Dispatcher $dispatcher

Return Value

void

void injectSignalSlotDispatcher(Dispatcher $signalSlotDispatcher)

No description

Parameters

Dispatcher $signalSlotDispatcher

Return Value

void

void injectBootstrap(Bootstrap $bootstrap)

No description

Parameters

Bootstrap $bootstrap

Return Value

void

void injectCacheManager(CacheManager $cacheManager)

No description

Parameters

CacheManager $cacheManager

Return Value

void

void injectProxyClassCompiler(Compiler $proxyClassCompiler)

No description

Parameters

Compiler $proxyClassCompiler

Return Value

void

void injectAopProxyClassBuilder(ProxyClassBuilder $aopProxyClassBuilder)

No description

Parameters

ProxyClassBuilder $aopProxyClassBuilder

Return Value

void

void injectDependencyInjectionProxyClassBuilder(ProxyClassBuilder $dependencyInjectionProxyClassBuilder)

No description

Parameters

ProxyClassBuilder $dependencyInjectionProxyClassBuilder

Return Value

void

void injectEnvironment(Environment $environment)

No description

Parameters

Environment $environment

Return Value

void

void compileCommand(bool $force = false)

Explicitly compile proxy classes

The compile command triggers the proxy class compilation. Although a compilation run is triggered automatically by Flow, there might be cases in a production context where a manual compile run is needed.

Parameters

bool $force

If set, classes will be compiled even though the cache says that everything is up to date.

Return Value

void

void setFilePermissionsCommand(string $commandlineUser, string $webserverUser, string $webserverGroup)

Adjust file permissions for CLI and web server access

This command adjusts the file permissions of the whole Flow application to the given command line user and webserver user / group.

Parameters

string $commandlineUser

User name of the command line user, for example "john"

string $webserverUser

User name of the webserver, for example "www-data"

string $webserverGroup

Group name of the webserver, for example "www-data"

Return Value

void

void migrateCommand(string $package, bool $status = false, string $packagesPath = null, string $version = null, bool $verbose = false, bool $force = false)

Migrate source files as needed

This will apply pending code migrations defined in packages to the specified package.

For every migration that has been run, it will create a commit in the package. This allows for easy inspection, rollback and use of the fixed code. If the affected package contains local changes or is not part of a git repository, the migration will be skipped. With the --force flag this behavior can be changed, but changes will only be committed if the working copy was clean before applying the migration.

Parameters

string $package

The key of the package to migrate

bool $status

Show the migration status, do not run migrations

string $packagesPath

If set, use the given path as base when looking for packages

string $version

If set, execute only the migration with the given version (e.g. "20150119114100")

bool $verbose

If set, notes and skipped migrations will be rendered

bool $force

By default packages that are not under version control or contain local changes are skipped. With this flag set changes are applied anyways (changes are not committed if there are local changes though)

Return Value

void

See also

neos.flow:doctrine:migrate

protected void emitFinishedCompilationRun(int $classCount)

Signals that the compile command was successfully finished.

Parameters

int $classCount

Number of compiled proxy classes

Return Value

void