Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 68 lines (60 sloc) 2.095 kb
d2b2a18 @fabpot added files
fabpot authored
1 <?php
2
87ad04f @willdurand Fixed LICENSE
willdurand authored
3 /**
4 * This file is part of the PropelBundle package.
5 * For the full copyright and license information, please view the LICENSE
6 * file that was distributed with this source code.
7 *
8 * @license MIT License
9 */
10
5b5feec @willdurand Changed namespace to Propel\PropelBundle
willdurand authored
11 namespace Propel\PropelBundle\Command;
d2b2a18 @fabpot added files
fabpot authored
12
29ca595 @willdurand Removed 'Propel' class prefixes
willdurand authored
13 use Propel\PropelBundle\Command\AbstractCommand;
d2b2a18 @fabpot added files
fabpot authored
14 use Symfony\Component\Console\Input\InputInterface;
a30747e @willdurand Added a better way to use a bundle argument in commands
willdurand authored
15 use Symfony\Component\Console\Input\InputArgument;
d2b2a18 @fabpot added files
fabpot authored
16 use Symfony\Component\Console\Output\OutputInterface;
17
18 /**
07f7ec7 @willdurand [Command] Refactored some commands.
willdurand authored
19 * ModelBuildCommand.
d2b2a18 @fabpot added files
fabpot authored
20 *
21 * @author Fabien Potencier <fabien.potencier@symfony-project.com>
4d98e51 @willdurand Added getters
willdurand authored
22 * @author William DURAND <william.durand1@gmail.com>
d2b2a18 @fabpot added files
fabpot authored
23 */
29ca595 @willdurand Removed 'Propel' class prefixes
willdurand authored
24 class ModelBuildCommand extends AbstractCommand
d2b2a18 @fabpot added files
fabpot authored
25 {
26 /**
27 * @see Command
28 */
29 protected function configure()
30 {
31 $this
32 ->setDescription('Build the Propel Object Model classes based on XML schemas')
a30747e @willdurand Added a better way to use a bundle argument in commands
willdurand authored
33 ->addArgument('bundle', InputArgument::OPTIONAL, 'The bundle to generate model classes from')
d2b2a18 @fabpot added files
fabpot authored
34 ->setHelp(<<<EOT
07f7ec7 @willdurand [Command] Refactored some commands.
willdurand authored
35 The <info>%command.name%</info> command builds the Propel runtime model classes (ActiveRecord, Query, Peer, and TableMap classes) based on the XML schemas defined in all Bundles.
d2b2a18 @fabpot added files
fabpot authored
36
07f7ec7 @willdurand [Command] Refactored some commands.
willdurand authored
37 <info>php app/console %command.full_name%</info>
d2b2a18 @fabpot added files
fabpot authored
38 EOT
39 )
07f7ec7 @willdurand [Command] Refactored some commands.
willdurand authored
40 ->setName('propel:model:build')
d2b2a18 @fabpot added files
fabpot authored
41 ;
42 }
43
44 /**
45 * @see Command
46 *
47 * @throws \InvalidArgumentException When the target directory does not exist
48 */
49 protected function execute(InputInterface $input, OutputInterface $output)
50 {
17d994b @fzaninotto Added support for the debug option in build-model and build-sql commands
fzaninotto authored
51 if ($input->getOption('verbose')) {
35a56e8 @willdurand Improved commands
willdurand authored
52 $this->additionalPhingArgs[] = 'verbose';
17d994b @fzaninotto Added support for the debug option in build-model and build-sql commands
fzaninotto authored
53 }
d2b2a18 @fabpot added files
fabpot authored
54
ad6c575 @willdurand Fixed output in build command
willdurand authored
55 if (true === $this->callPhing('om')) {
4c07e38 @willdurand Added a way to detect errors during Phing execution
willdurand authored
56 foreach ($this->tempSchemas as $schemaFile => $schemaDetails) {
f18df26 @willdurand [command] Fixed output (for real)
willdurand authored
57 $output->writeln(sprintf(
5573f9d @willdurand Tweaked output of 'build-model' command
willdurand authored
58 '>> <info>%20s</info> Generated model classes from <comment>%s</comment>',
f18df26 @willdurand [command] Fixed output (for real)
willdurand authored
59 $schemaDetails['bundle'],
60 $schemaDetails['basename']
61 ));
4c07e38 @willdurand Added a way to detect errors during Phing execution
willdurand authored
62 }
63 } else {
f18df26 @willdurand [command] Fixed output (for real)
willdurand authored
64 $this->writeTaskError($output, 'om');
da462aa @willdurand Added output message to the 'build-model' command
willdurand authored
65 }
66 }
d2b2a18 @fabpot added files
fabpot authored
67 }
Something went wrong with that request. Please try again.