class PackageCommandController extends CommandController (View source)

Package command controller to handle packages from CLI

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 PackageManager $packageManager
protected array $settings
protected Bootstrap $bootstrap

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
injectSettings(array $settings)

No description

void
injectPackageManager(PackageManager $packageManager)

No description

void
injectBootstrap(Bootstrap $bootstrap)

No description

void
createCommand(string $packageKey, string $packageType = PackageInterface::DEFAULT_COMPOSER_TYPE)

Create a new package

void
listCommand(bool $loadingOrder = false)

List available packages

void
freezeCommand(string $packageKey = 'all')

Freeze a package

void
unfreezeCommand(string $packageKey = 'all')

Unfreeze a package

void
refreezeCommand(string $packageKey = 'all')

Refreeze a package

rescanCommand()

Rescan package availability and recreates the PackageStates configuration.

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 injectSettings(array $settings)

No description

Parameters

array $settings

The Flow settings

Return Value

void

void injectPackageManager(PackageManager $packageManager)

No description

Parameters

PackageManager $packageManager

Return Value

void

void injectBootstrap(Bootstrap $bootstrap)

No description

Parameters

Bootstrap $bootstrap

Return Value

void

void createCommand(string $packageKey, string $packageType = PackageInterface::DEFAULT_COMPOSER_TYPE)

Create a new package

This command creates a new package which contains only the mandatory directories and files.

Parameters

string $packageKey

The package key of the package to create

string $packageType

The package type of the package to create

Return Value

void

See also

neos.kickstarter:kickstart:package

void listCommand(bool $loadingOrder = false)

List available packages

Lists all locally available packages. Displays the package key, version and package title.

Parameters

bool $loadingOrder

The returned packages are ordered by their loading order.

Return Value

void

The list of packages

void freezeCommand(string $packageKey = 'all')

Freeze a package

This function marks a package as frozen in order to improve performance in a development context. While a package is frozen, any modification of files within that package won't be tracked and can lead to unexpected behavior.

File monitoring won't consider the given package. Further more, reflection data for classes contained in the package is cached persistently and loaded directly on the first request after caches have been flushed. The precompiled reflection data is stored in the Configuration directory of the respective package.

By specifying all as a package key, all currently frozen packages are frozen (the default).

Parameters

string $packageKey

Key of the package to freeze

Return Value

void

See also

neos.flow:package:unfreeze
neos.flow:package:refreeze

void unfreezeCommand(string $packageKey = 'all')

Unfreeze a package

Unfreezes a previously frozen package. On the next request, this package will be considered again by the file monitoring and related services – if they are enabled in the current context.

By specifying all as a package key, all currently frozen packages are unfrozen (the default).

Parameters

string $packageKey

Key of the package to unfreeze, or 'all'

Return Value

void

See also

neos.flow:package:freeze
neos.flow:cache:flush

void refreezeCommand(string $packageKey = 'all')

Refreeze a package

Refreezes a currently frozen package: all precompiled information is removed and file monitoring will consider the package exactly once, on the next request. After that request, the package remains frozen again, just with the updated data.

By specifying all as a package key, all currently frozen packages are refrozen (the default).

Parameters

string $packageKey

Key of the package to refreeze, or 'all'

Return Value

void

See also

neos.flow:package:freeze
neos.flow:cache:flush

rescanCommand()

Rescan package availability and recreates the PackageStates configuration.