Last active
August 29, 2015 14:06
-
-
Save ziadoz/f9da0956c343509ee503 to your computer and use it in GitHub Desktop.
Add PHPMig Commands to Custom Symfony Console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/vendor/autoload.php'; | |
use Symfony\Component\Console\Application; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Input\InputArgument; | |
use Symfony\Component\Console\Input\InputOption; | |
use Phpmig\Console\Command\CheckCommand; | |
use Phpmig\Console\Command\DownCommand; | |
use Phpmig\Console\Command\GenerateCommand; | |
use Phpmig\Console\Command\InitCommand; | |
use Phpmig\Console\Command\MigrateCommand; | |
use Phpmig\Console\Command\RedoCommand; | |
use Phpmig\Console\Command\RollbackCommand; | |
use Phpmig\Console\Command\StatusCommand; | |
use Phpmig\Console\Command\UpCommand; | |
$console = new Application('Application', '1.0'); | |
$console->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The environment name.', 'dev')); | |
$commands = array( | |
new CheckCommand(), | |
new DownCommand(), | |
new GenerateCommand(), | |
new InitCommand(), | |
new MigrateCommand(), | |
new RedoCommand(), | |
new RollbackCommand(), | |
new StatusCommand(), | |
new UpCommand(), | |
); | |
foreach ($commands as $command) { | |
$command->setName('database:' . $command->getName()); | |
} | |
$console->addCommands($commands); | |
return $console; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment