rossriley / doctrine-migrations-helper
Setup tool to provide configured Doctrine Migration Commands
Installs: 1 245
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- doctrine/migrations: ^1.0
- symfony/console: ^2.0 | ^3.0 | ^4.0 | ^5.0
This package is not auto-updated.
Last update: 2024-11-19 09:16:46 UTC
README
This package allows the setting up of the Doctrine CLI Tools with less Boilerplate and no Config Files.
You may want to use this if you prefer to initialise migrations from your own configuration / DI container rather than requiring an xml / yml migrations configuration file.
It depends on DBAL and must be initialised with a valid DriverConnection
Usage
The set is designed to be passed straight to a Symfony Console Application, usage may be as follows:
use DoctrineMigrationsHelper\CommandSet;
$set = new CommandSet($db_connection, $namespace, $directory);
$console->addCommands($set->getCommands());
The created configuration is available as a public property on the CommandSet so it can be manipulated in the same way as a normal Migrations configuration. For example:
use DoctrineMigrationsHelper\CommandSet;
$set = new CommandSet($db_connection);
$set->configuration->setMigrationsNamespace("Example\Namespace");
$console->addCommands($set->getCommands());
All standard CLI tools are setup by default, you can override this by manually setting the $set->commands
array with your own set.
Additionally if your DI constructs a migrations configuration you can just overwrite the auto created one. For example:
$set = new CommandSet($container->get("db-connection"));
$set->configuration = $container->get("migrations");
$console->addCommands($set->getCommands());