Consider the connection option while aggregating the schemas
This commit is contained in:
parent
7c7ac126e4
commit
41ebcdbaa7
|
@ -38,6 +38,12 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
*/
|
*/
|
||||||
protected $bundle = null;
|
protected $bundle = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var InputInterface
|
||||||
|
*/
|
||||||
|
protected $input;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
@ -67,11 +73,11 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$this->setupBuildTimeFiles();
|
|
||||||
|
|
||||||
$params = $this->getSubCommandArguments($input);
|
$params = $this->getSubCommandArguments($input);
|
||||||
$command = $this->createSubCommandInstance();
|
$command = $this->createSubCommandInstance();
|
||||||
|
|
||||||
|
$this->setupBuildTimeFiles();
|
||||||
|
|
||||||
return $this->runCommand($command, $params, $input, $output);
|
return $this->runCommand($command, $params, $input, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,13 +88,15 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
{
|
{
|
||||||
parent::initialize($input, $output);
|
parent::initialize($input, $output);
|
||||||
|
|
||||||
|
$this->input = $input;
|
||||||
|
|
||||||
$this->checkConfiguration();
|
$this->checkConfiguration();
|
||||||
|
|
||||||
if ($input->hasArgument('bundle') && '@' === substr($input->getArgument('bundle'), 0, 1)) {
|
if ($input->hasArgument('bundle') && !empty($input->getArgument('bundle'))) {
|
||||||
$this->bundle = $this
|
$this->bundle = $this
|
||||||
->getContainer()
|
->getContainer()
|
||||||
->get('kernel')
|
->get('kernel')
|
||||||
->getBundle(substr($input->getArgument('bundle'), 1));
|
->getBundle($input->getArgument('bundle'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,14 +183,17 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo
|
if ($this->input->hasOption('connection')) {
|
||||||
//if ($this->input && $this->input->hasOption('connection') && $this->input->getOption('connection')
|
$connections = $this->input->getOption('connection') ?: array($this->getContainer()->getParameter('propel.dbal.default_connection'));
|
||||||
// && $database['name'] != $this->input->getOption('connection')) {
|
|
||||||
// //we skip this schema because the connection name doesn't match the input value
|
if (!in_array($database['name'], $connections)) {
|
||||||
// unset($this->tempSchemas[$tempSchema]);
|
// we skip this schema because the connection name doesn't
|
||||||
// $filesystem->remove($file);
|
// match the input values
|
||||||
// continue;
|
unset($this->tempSchemas[$tempSchema]);
|
||||||
//}
|
$filesystem->remove($file);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($database->table as $table) {
|
foreach ($database->table as $table) {
|
||||||
if (isset($table['package'])) {
|
if (isset($table['package'])) {
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
namespace Propel\PropelBundle\Command;
|
namespace Propel\PropelBundle\Command;
|
||||||
|
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,6 +30,7 @@ class ModelBuildCommand extends AbstractCommand
|
||||||
->setName('propel:model:build')
|
->setName('propel:model:build')
|
||||||
->setDescription('Build the model classes based on Propel XML schemas')
|
->setDescription('Build the model classes based on Propel XML schemas')
|
||||||
|
|
||||||
|
->addOption('connection', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'Connection to use. Example: default, bookstore')
|
||||||
->addArgument('bundle', InputArgument::OPTIONAL, 'The bundle to generate model classes from')
|
->addArgument('bundle', InputArgument::OPTIONAL, 'The bundle to generate model classes from')
|
||||||
// @todo add the other arguments/options handled by the command
|
// @todo add the other arguments/options handled by the command
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in a new issue