Merge pull request #239 from auss/1.2

Support for --verbose option and error handling in generate-diff command
This commit is contained in:
William Durand 2013-06-13 05:25:36 -07:00
commit 4d24642ac2
2 changed files with 15 additions and 3 deletions

View file

@ -95,6 +95,10 @@ abstract class AbstractCommand extends ContainerAwareCommand
protected function initialize(InputInterface $input, OutputInterface $output)
{
parent::initialize($input, $output);
if ($input->getOption('verbose')) {
$this->additionalPhingArgs[] = 'verbose';
}
$this->input = $input;

View file

@ -47,8 +47,16 @@ EOT
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->callPhing('diff');
$this->writeSummary($output, 'propel-sql-diff');
if (true === $this->callPhing('diff')) {
$this->writeSummary($output, 'propel-sql-diff');
} elseif ( strpos( $this->buffer, 'Uncommitted migrations have been found' ) ) {
$this->writeSection($output, array(
'[Propel] Error',
'',
'Uncommitted migrations have been found. You should either execute or delete them before rerunning the propel:migration:generate-diff command.'
), 'fg=white;bg=red');
} else {
$this->writeTaskError($output, 'propel-sql-diff');
}
}
}