add connection option for commands: build, sql:build, migration:generate-diff

This commit is contained in:
jaugustin 2012-10-23 01:02:00 +02:00
commit a8bb6a2a8b
6 changed files with 42 additions and 16 deletions

View file

@ -60,6 +60,12 @@ abstract class AbstractCommand extends ContainerAwareCommand
*/
private $alreadyWroteConnection = false;
/**
*
* @var InputInterface
*/
protected $input;
/**
* Return the package prefix for a given bundle.
*
@ -90,6 +96,8 @@ abstract class AbstractCommand extends ContainerAwareCommand
{
parent::initialize($input, $output);
$this->input = $input;
$this->checkConfiguration();
if ($input->hasArgument('bundle') && '@' === substr($input->getArgument('bundle'), 0, 1)) {
@ -227,6 +235,13 @@ abstract class AbstractCommand extends ContainerAwareCommand
);
}
if ($this->input && $this->input->hasOption('connection') && $this->input->getOption('connection')
&& $database['name'] != $this->input->getOption('connection')) {
//we skip this schema because the connection name doesn't match the input value
$filesystem->remove($file);
continue;
}
foreach ($database->table as $table) {
if (isset($table['package'])) {
$table['package'] = $table['package'];