KickstartCommandController
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
Resolves and checks the current command method name
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.
Maps arguments delivered by the request object to the local controller arguments.
Forwards the request to another command and / or CommandController.
Calls the specified command method and passes the arguments.
Returns the CLI Flow command depending on the environment
Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf
Outputs specified text to the console window and appends a line break
Formats the given text to fit into MAXIMUM_LINE_LENGTH and outputs it to the console window
Exits the CLI through the dispatcher and makes sure that Flow is properly shut down.
Sends the response and exits the CLI without any further code execution Should be used for commands that flush code caches.
Kickstart a new package
Kickstart a new action controller
Kickstart a new command controller
Kickstart a new domain model
Kickstart a new domain repository
Kickstart documentation
Kickstart translation
Checks the syntax of the given $packageKey and quits with an error message if it's not valid
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
void
injectObjectManager(ObjectManagerInterface $objectManager)
Injects the reflection service
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.
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.
protected void
mapRequestArgumentsToControllerArguments()
Maps arguments delivered by the request object to the local controller arguments.
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.
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.
string
getFlowInvocationString()
Returns the CLI Flow command depending on the environment
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
protected void
outputLine(string $text = '', array $arguments = [])
Outputs specified text to the console window and appends a line break
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
protected
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().
protected
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.
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.
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.
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.
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").
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.
documentationCommand(string $packageKey)
Kickstart documentation
Generates a documentation skeleton for the given package.
void
translationCommand(string $packageKey, string $sourceLanguageKey, array $targetLanguageKeys = [])
Kickstart translation
Generates the translation files for the given package.
protected void
validatePackageKey(string $packageKey)
Checks the syntax of the given $packageKey and quits with an error message if it's not valid
protected
validateModelName(string $modelName)
Check the given model name to be not one of the reserved words of PHP.