Development

/branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildAllTask.class.php

You must first sign up to be able to contribute.

root/branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildAllTask.class.php

Revision 8970, 2.2 kB (checked in by Carl.Vondrick, 7 years ago)

1.1: added cli option to skip building forms when using propel:build-all[-load] tasks to avoid cluttering lib/form (closes #3420)

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 require_once(dirname(__FILE__).'/sfPropelBaseTask.class.php');
12
13 /**
14  * Generates Propel model, SQL and initializes the database.
15  *
16  * @package    symfony
17  * @subpackage command
18  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
19  * @version    SVN: $Id$
20  */
21 class sfPropelBuildAllTask extends sfPropelBaseTask
22 {
23   /**
24    * @see sfTask
25    */
26   protected function configure()
27   {
28     $this->aliases = array('propel-build-all');
29     $this->namespace = 'propel';
30     $this->name = 'build-all';
31     $this->briefDescription = 'Generates Propel model, SQL and initializes the database';
32
33     $this->addOptions(array(
34       new sfCommandOption('skip-forms', 'F', sfCommandOption::PARAMETER_NONE, 'Skip generating forms')
35     ));
36
37     $this->detailedDescription = <<<EOF
38 The [propel:build-all|INFO] task is a shortcut for three other tasks:
39
40   [./symfony propel:build-all|INFO]
41
42 The task is equivalent to:
43
44   [./symfony propel:build-model|INFO]
45   [./symfony propel:build-sql|INFO]
46   [./symfony propel:build-forms|INFO]
47   [./symfony propel:insert-sql|INFO]
48
49 See those three tasks help page for more information.
50 EOF;
51   }
52
53   /**
54    * @see sfTask
55    */
56   protected function execute($arguments = array(), $options = array())
57   {
58     $buildModel = new sfPropelBuildModelTask($this->dispatcher, $this->formatter);
59     $buildModel->setCommandApplication($this->commandApplication);
60     $buildModel->run();
61
62     $buildSql = new sfPropelBuildSqlTask($this->dispatcher, $this->formatter);
63     $buildSql->setCommandApplication($this->commandApplication);
64     $buildSql->run();
65
66     if (!$options['skip-forms'])
67     {
68       $buildForms = new sfPropelBuildFormsTask($this->dispatcher, $this->formatter);
69       $buildForms->setCommandApplication($this->commandApplication);
70       $buildForms->run();
71     }
72
73     $insertSql = new sfPropelInsertSqlTask($this->dispatcher, $this->formatter);
74     $insertSql->setCommandApplication($this->commandApplication);
75     $insertSql->run();
76   }
77 }
78
Note: See TracBrowser for help on using the browser.