class KickstartCommandController extends CommandController (View source)

Command controller for the Kickstart generator

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 GeneratorService $generatorService

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

void
quit(int $exitCode = 0)

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

void
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.

string
packageCommand(string $packageKey, string $packageType = PackageInterface::DEFAULT_COMPOSER_TYPE)

Kickstart a new package

string
actionControllerCommand(string $packageKey, string $controllerName, bool $generateActions = false, bool $generateTemplates = true, bool $generateFusion = false, bool $generateRelated = false, bool $force = false)

Kickstart a new action controller

string
commandControllerCommand(string $packageKey, string $controllerName, bool $force = false)

Kickstart a new command controller

string
modelCommand(string $packageKey, string $modelName, bool $force = false)

Kickstart a new domain model

string
repositoryCommand(string $packageKey, string $modelName, bool $force = false)

Kickstart a new domain repository

string
documentationCommand(string $packageKey)

Kickstart documentation

void
translationCommand(string $packageKey, string $sourceLanguageKey, array $targetLanguageKeys = [])

Kickstart translation

void
validatePackageKey(string $packageKey)

Checks the syntax of the given $packageKey and quits with an error message if it's not valid

bool
validateModelName(string $modelName)

Check the given model name to be not one of the reserved words of PHP.

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 void 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

void

Exceptions

StopCommandException

protected void 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

void

string packageCommand(string $packageKey, string $packageType = PackageInterface::DEFAULT_COMPOSER_TYPE)

Kickstart a new package

Creates a new package and creates a standard Action Controller and a sample template for its Index Action.

For creating a new package without sample code use the package:create command.

Parameters

string $packageKey

The package key, for example "MyCompany.MyPackageName"

string $packageType

Optional package type, e.g. "neos-plugin"

Return Value

string

See also

neos.flow:package:create

string actionControllerCommand(string $packageKey, string $controllerName, bool $generateActions = false, bool $generateTemplates = true, bool $generateFusion = false, bool $generateRelated = false, bool $force = false)

Kickstart a new action controller

Generates an Action Controller with the given name in the specified package. In its default mode it will create just the controller containing a sample indexAction.

By specifying the --generate-actions flag, this command will also create a set of actions. If no model or repository exists which matches the controller name (for example "CoffeeRepository" for "CoffeeController"), an error will be shown.

Likewise the command exits with an error if the specified package does not exist. By using the --generate-related flag, a missing package, model or repository can be created alongside, avoiding such an error.

By specifying the --generate-templates flag, this command will also create matching Fluid templates for the actions created. Alternatively, by specifying the --generate-fusion flag, this command will create matching Fusion files for the actions.

The default behavior is to not overwrite any existing code. This can be overridden by specifying the --force flag.

Parameters

string $packageKey

The package key of the package for the new controller with an optional subpackage, (e.g. "MyCompany.MyPackage/Admin").

string $controllerName

The name for the new controller. This may also be a comma separated list of controller names.

bool $generateActions

Also generate index, show, new, create, edit, update and delete actions.

bool $generateTemplates

Also generate the templates for each action.

bool $generateFusion

If Fusion templates should be generated instead of Fluid.

bool $generateRelated

Also create the mentioned package, related model and repository if necessary.

bool $force

Overwrite any existing controller or template code. Regardless of this flag, the package, model and repository will never be overwritten.

Return Value

string

See also

neos.kickstarter:kickstart:commandcontroller

string commandControllerCommand(string $packageKey, string $controllerName, bool $force = false)

Kickstart a new command controller

Creates a new command controller with the given name in the specified package. The generated controller class already contains an example command.

Parameters

string $packageKey

The package key of the package for the new controller

string $controllerName

The name for the new controller. This may also be a comma separated list of controller names.

bool $force

Overwrite any existing controller.

Return Value

string

See also

neos.kickstarter:kickstart:actioncontroller

string modelCommand(string $packageKey, string $modelName, bool $force = false)

Kickstart a new domain model

This command generates a new domain model class. The fields are specified as a variable list of arguments with field name and type separated by a colon (for example "title:string" "size:int" "type:MyType").

Parameters

string $packageKey

The package key of the package for the domain model

string $modelName

The name of the new domain model class

bool $force

Overwrite any existing model.

Return Value

string

See also

neos.kickstarter:kickstart:repository

string repositoryCommand(string $packageKey, string $modelName, bool $force = false)

Kickstart a new domain repository

This command generates a new domain repository class for the given model name.

Parameters

string $packageKey

The package key

string $modelName

The name of the domain model class

bool $force

Overwrite any existing repository.

Return Value

string

See also

neos.kickstarter:kickstart:model

string documentationCommand(string $packageKey)

Kickstart documentation

Generates a documentation skeleton for the given package.

Parameters

string $packageKey

The package key of the package for the documentation

Return Value

string

void translationCommand(string $packageKey, string $sourceLanguageKey, array $targetLanguageKeys = [])

Kickstart translation

Generates the translation files for the given package.

Parameters

string $packageKey

The package key of the package for the translation

string $sourceLanguageKey

The language key of the default language

array $targetLanguageKeys

Comma separated language keys for the target translations

Return Value

void

protected void validatePackageKey(string $packageKey)

Checks the syntax of the given $packageKey and quits with an error message if it's not valid

Parameters

string $packageKey

Return Value

void

protected bool validateModelName(string $modelName)

Check the given model name to be not one of the reserved words of PHP.

Parameters

string $modelName

Return Value

bool

See also

http://www.php.net/manual/en/reserved.keywords.php