Refactored command: status
This commit is contained in:
parent
047d83f33e
commit
5576005b6d
1 changed files with 5 additions and 25 deletions
|
|
@ -6,19 +6,10 @@ use Propel\PropelBundle\Command\PhingCommand;
|
|||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* MigrationStatusCommand.
|
||||
*
|
||||
* @author William DURAND <william.durand1@gmail.com>
|
||||
* @author William DURAND <william.durand1@gmail.com>
|
||||
*/
|
||||
class MigrationStatusCommand extends PhingCommand
|
||||
{
|
||||
|
|
@ -30,8 +21,8 @@ class MigrationStatusCommand extends PhingCommand
|
|||
$this
|
||||
->setDescription('Lists the migrations yet to be executed')
|
||||
->setHelp(<<<EOT
|
||||
The <info>propel:migration:status</info> command checks the version of the database structure, and looks for migration files not yet executed (i.e. with a greater version timestamp).
|
||||
|
||||
The <info>propel:migration:status</info> command checks the version of the database structure, and looks for migration files not yet executed (i.e. with a greater version timestamp).
|
||||
|
||||
<info>php app/console propel:migration:status</info>
|
||||
EOT
|
||||
)
|
||||
|
|
@ -45,20 +36,9 @@ EOT
|
|||
* @throws \InvalidArgumentException When the target directory does not exist
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
{
|
||||
$this->callPhing('status');
|
||||
|
||||
foreach (explode("\n", $this->buffer) as $line) {
|
||||
if (false !== strpos($line, '[propel-migration-status]')) {
|
||||
$arr = preg_split('#\[propel-migration-status\] #', $line);
|
||||
$info = $arr[1];
|
||||
|
||||
if (' ' === $info[0]) {
|
||||
$info = sprintf('<info>%s</info>', $info);
|
||||
}
|
||||
|
||||
$output->writeln($info);
|
||||
}
|
||||
}
|
||||
$this->summary($output, 'propel-migration-status');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue