* * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ /** * BuildCommand. * * @author Fabien Potencier */ class BuildCommand extends PhingCommand { protected $additionalPhingArgs = array(); /** * @see Command */ protected function configure() { $this ->setDescription('Hub for Propel build commands (model, sql)') ->setDefinition(array( new InputOption('--classes', '', InputOption::VALUE_NONE, 'Build only classes'), new InputOption('--sql', '', InputOption::VALUE_NONE, 'Build only code'), )) ->setName('propel:build') ; } /** * @see Command * * @throws \InvalidArgumentException When the target directory does not exist */ protected function execute(InputInterface $input, OutputInterface $output) { if (!$input->getOption('sql')) { $output->writeln('Building model classes'); $modelCommand = new BuildModelCommand(); $modelCommand->setApplication($this->application); $modelCommand->execute($input, $output); } if (!$input->getOption('classes')) { $output->writeln('Building model sql'); $sqlCommand = new BuildSQLCommand(); $sqlCommand->setApplication($this->application); $sqlCommand->execute($input, $output); } } }