[command] Fixed build command information

This commit is contained in:
William DURAND 2011-09-05 00:15:47 +02:00
commit fbb785274c

View file

@ -13,6 +13,7 @@ namespace Propel\PropelBundle\Command;
use Propel\PropelBundle\Command\PhingCommand;
use Propel\PropelBundle\Command\BuildModelCommand;
use Propel\PropelBundle\Command\BuildSqlCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
@ -27,18 +28,16 @@ use Symfony\Component\Console\Output\Output;
*/
class BuildCommand extends PhingCommand
{
protected $additionalPhingArgs = array();
/**
* @see Command
*/
protected function configure()
{
$this
->setDescription('Hub for Propel build commands (model, sql)')
->setDescription('Hub for Propel build commands (Model classes, SQL)')
->setDefinition(array(
new InputOption('classes', '', InputOption::VALUE_NONE, 'Build only classes'),
new InputOption('sql', '', InputOption::VALUE_NONE, 'Build only code'),
new InputOption('sql', '', InputOption::VALUE_NONE, 'Build only SQL'),
new InputOption('insert-sql', '', InputOption::VALUE_NONE, 'Build all and insert SQL'),
new InputOption('connection', null, InputOption::VALUE_OPTIONAL, 'Set this parameter to define a connection to use')
))
@ -53,21 +52,18 @@ class BuildCommand extends PhingCommand
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!$input->getOption('sql')) {
$output->writeln('<comment>Building model classes:</comment>');
$modelCommand = new BuildModelCommand();
$modelCommand->setApplication($this->getApplication());
$modelCommand->execute($input, $output);
}
if (!$input->getOption('classes')) {
$output->writeln('<comment>Building model sql:</comment>');
$sqlCommand = new BuildSQLCommand();
$sqlCommand->setApplication($this->getApplication());
$sqlCommand->execute($input, $output);
}
if ($input->getOption('insert-sql')) {
$output->writeln('<comment>Inserting SQL statements:</comment>');
$insertCommand = new InsertSqlCommand();
$insertCommand->setApplication($this->getApplication());