DoctrineCommandController
class DoctrineCommandController extends CommandController (View source)
Command controller for tasks related to Doctrine
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 array | $settings | ||
protected Service | $doctrineService | ||
protected PackageManager | $packageManager | ||
protected ThrowableStorageInterface | $throwableStorage | ||
protected LoggerInterface | $logger |
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.
Injects the Flow settings, only the persistence part is kept for further use
No description
Compile the Doctrine proxy classes
Validate the class/table mappings
Create the database schema
Update the database schema
Show the current status of entities and mappings
Run arbitrary DQL and display results
Show the current migration status
Migrate the database schema
No description
Execute a single migration
Mark/unmark migrations as migrated
Generate a new migration
No description
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 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().
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.
void
injectSettings(array $settings)
Injects the Flow settings, only the persistence part is kept for further use
void
injectLogger(LoggerInterface $logger)
No description
void
compileProxiesCommand()
Compile the Doctrine proxy classes
void
validateCommand()
Validate the class/table mappings
Checks if the current class model schema is valid. Any inconsistencies in the relations between models (for example caused by wrong or missing annotations) will be reported.
Note that this does not check the table structure in the database in any way.
void
createCommand(string $output = null)
Create the database schema
Creates a new database schema based on the current mapping information.
It expects the database to be empty, if tables that are to be created already exist, this will lead to errors.
void
updateCommand(bool $unsafeMode = false, string $output = null)
Update the database schema
Updates the database schema without using existing migrations.
It will not drop foreign keys, sequences and tables, unless --unsafe-mode is set.
void
entityStatusCommand(bool $dumpMappingData = false, string $entityClassName = null)
Show the current status of entities and mappings
Shows basic information about which entities exist and possibly if their mapping information contains errors or not.
To run a full validation, use the validate command.
void
dqlCommand(int $depth = 3, string $hydrationMode = 'array', int $offset = null, int $limit = null)
Run arbitrary DQL and display results
Any DQL queries passed after the parameters will be executed, the results will be output:
doctrine:dql --limit 10 'SELECT a FROM Neos\Flow\Security\Account a'
void
migrationStatusCommand(bool $showMigrations = false)
Show the current migration status
Displays the migration configuration as well as the number of available, executed and pending migrations.
void
migrateCommand(string $version = 'latest', string $output = null, bool $dryRun = false, bool $quiet = false)
Migrate the database schema
Adjusts the database structure by applying the pending migrations provided by currently active packages.
protected void
emitAfterDatabaseMigration()
No description
void
migrationExecuteCommand(string $version, string $direction = 'up', string $output = null, bool $dryRun = false)
Execute a single migration
Manually runs a single migration in the given direction.
void
migrationVersionCommand(string $version, bool $add = false, bool $delete = false)
Mark/unmark migrations as migrated
If all is given as version, all available migrations are marked as requested.
void
migrationGenerateCommand(bool $diffAgainstCurrent = true, string $filterExpression = null, bool $force = false)
Generate a new migration
If $diffAgainstCurrent is true (the default), it generates a migration file with the diff between current DB structure and the found mapping metadata.
Otherwise an empty migration skeleton is generated.
Only includes tables/sequences matching the $filterExpression regexp when diffing models and existing schema. Include delimiters in the expression! The use of
--filter-expression '/^acme_com/'
would only create a migration touching tables starting with "acme_com".
Note: A filter-expression will overrule any filter configured through the Neos.Flow.persistence.doctrine.migrations.ignoredTables setting
protected void
handleException(Exception $exception)
Output an error message and log the exception.
protected bool
isDatabaseConfigured()
No description