Started to work on Propel2 commands integration (only a few work at the moment)
This commit is contained in:
parent
313057ca5a
commit
38e7f63a62
9 changed files with 824 additions and 0 deletions
58
Command/MigrationStatusCommand.php
Normal file
58
Command/MigrationStatusCommand.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the PropelBundle package.
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @license MIT License
|
||||
*/
|
||||
|
||||
namespace Propel\PropelBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
use Propel\Generator\Command\MigrationStatusCommand as BaseCommand;
|
||||
|
||||
/**
|
||||
* @author Kévin Gomez <contact@kevingomez.fr>
|
||||
*/
|
||||
class MigrationStatusCommand extends AbstractCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('propel:migration:status')
|
||||
->setDescription('Get migration status')
|
||||
|
||||
->addOption('connection', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'Connection to use. Example: default, bookstore')
|
||||
->addOption('migration-table', null, InputOption::VALUE_REQUIRED, 'Migration table name', BaseCommand::DEFAULT_MIGRATION_TABLE)
|
||||
->addOption('output-dir', null, InputOption::VALUE_OPTIONAL, 'The output directory')
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$defaultOutputDir = $this->getApplication()->getKernel()->getRootDir().'/propel/migrations';
|
||||
|
||||
$this->setupBuildTimeFiles();
|
||||
|
||||
$params = array(
|
||||
'--connection' => $this->getConnections($input->getOption('connection')),
|
||||
'--migration-table' => $input->getOption('migration-table'),
|
||||
'--output-dir' => $input->getOption('output-dir') ?: $defaultOutputDir,
|
||||
);
|
||||
|
||||
return $this->runCommand(new BaseCommand(), $params, $input, $output);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue