Development

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

You must first sign up to be able to contribute.

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

Revision 10517, 2.3 kB (checked in by nicolas, 6 years ago)

[1.1] fixed database manager call from sfPropelBuildForms task generates an error

  • 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  * Create form classes for the current model.
15  *
16  * @package    symfony
17  * @subpackage command
18  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
19  * @version    SVN: $Id$
20  */
21 class sfPropelBuildFormsTask extends sfPropelBaseTask
22 {
23   /**
24    * @see sfTask
25    */
26   protected function configure()
27   {
28     $this->addOptions(array(
29       new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'),
30       new sfCommandOption('model-dir-name', null, sfCommandOption::PARAMETER_REQUIRED, 'The model dir name', 'model'),
31       new sfCommandOption('form-dir-name', null, sfCommandOption::PARAMETER_REQUIRED, 'The form dir name', 'form'),
32     ));
33
34     $this->namespace = 'propel';
35     $this->name = 'build-forms';
36     $this->briefDescription = 'Creates form classes for the current model';
37
38     $this->detailedDescription = <<<EOF
39 The [propel:build-forms|INFO] task creates form classes from the schema:
40
41   [./symfony propel:build-forms|INFO]
42
43 The task read the schema information in [config/*schema.xml|COMMENT] and/or
44 [config/*schema.yml|COMMENT] from the project and all installed plugins.
45
46 The task use the [propel|COMMENT] connection as defined in [config/databases.yml|COMMENT].
47 You can use another connection by using the [--connection|COMMENT] option:
48
49   [./symfony propel:build-forms --connection="name"|INFO]
50
51 The model form classes files are created in [lib/form|COMMENT].
52
53 This task never overrides custom classes in [lib/form|COMMENT].
54 It only replaces base classes generated in [lib/form/base|COMMENT].
55 EOF;
56   }
57
58   /**
59    * @see sfTask
60    */
61   protected function execute($arguments = array(), $options = array())
62   {
63     $this->logSection('propel', 'generating form classes');
64     
65     $generatorManager = new sfGeneratorManager($this->configuration);
66
67     $generatorManager->generate('sfPropelFormGenerator', array(
68       'connection'     => $options['connection'],
69       'model_dir_name' => $options['model-dir-name'],
70       'form_dir_name'  => $options['form-dir-name'],
71     ));
72   }
73 }
74
Note: See TracBrowser for help on using the browser.