Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

78 lines (67 sloc) 2.62 kB
* This file is part of the PropelBundle package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* @license MIT License
namespace Propel\PropelBundle\Command;
use Propel\PropelBundle\Command\AbstractCommand;
use Propel\PropelBundle\Command\ModelBuildCommand;
use Propel\PropelBundle\Command\SqlBuildCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
* BuildCommand.
* @author Fabien Potencier <>
* @author William DURAND <>
class BuildCommand extends AbstractCommand
* @see Command
protected function configure()
->setDescription('Hub for Propel build commands (Model classes, SQL)')
new InputOption('classes', '', InputOption::VALUE_NONE, 'Build only classes'),
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')
* @see Command
* @throws \InvalidArgumentException When the target directory does not exist
protected function execute(InputInterface $input, OutputInterface $output)
if (!$input->getOption('sql')) {
$modelCommand = new ModelBuildCommand();
$modelCommand->execute($input, $output);
if (!$input->getOption('classes')) {
$sqlCommand = new SqlBuildCommand();
$sqlCommand->execute($input, $output);
if ($input->getOption('insert-sql')) {
$insertCommand = new SqlInsertCommand();
// By-pass the '--force' required option
$this->addOption('force', '', InputOption::VALUE_NONE, '');
$input->setOption('force', true);
$insertCommand->execute($input, $output);
Jump to Line
Something went wrong with that request. Please try again.