Development

/branches/1.2/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildModelTask.class.php

You must first sign up to be able to contribute.

root/branches/1.2/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildModelTask.class.php

Revision 12129, 2.1 kB (checked in by Kris.Wallsmith, 6 years ago)

[1.2] Added --phing-arg option to those tasks that wrap phing tasks.

  • 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 classes for the current model.
15  *
16  * @package    symfony
17  * @subpackage propel
18  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
19  * @version    SVN: $Id$
20  */
21 class sfPropelBuildModelTask extends sfPropelBaseTask
22 {
23   /**
24    * @see sfTask
25    */
26   protected function configure()
27   {
28     $this->addOptions(array(
29       new sfCommandOption('phing-arg', null, sfCommandOption::PARAMETER_REQUIRED | sfCommandOption::IS_ARRAY, 'Arbitrary phing argument'),
30     ));
31
32     $this->aliases = array('propel-build-model');
33     $this->namespace = 'propel';
34     $this->name = 'build-model';
35     $this->briefDescription = 'Creates classes for the current model';
36
37     $this->detailedDescription = <<<EOF
38 The [propel:build-model|INFO] task creates model classes from the schema:
39
40   [./symfony propel:build-model|INFO]
41
42 The task read the schema information in [config/*schema.xml|COMMENT] and/or
43 [config/*schema.yml|COMMENT] from the project and all installed plugins.
44
45 You mix and match YML and XML schema files. The task will convert
46 YML ones to XML before calling the Propel task.
47
48 The model classes files are created in [lib/model|COMMENT].
49
50 This task never overrides custom classes in [lib/model|COMMENT].
51 It only replaces files in [lib/model/om|COMMENT] and [lib/model/map|COMMENT].
52 EOF;
53   }
54
55   /**
56    * @see sfTask
57    */
58   protected function execute($arguments = array(), $options = array())
59   {
60     $this->schemaToXML(self::DO_NOT_CHECK_SCHEMA, 'generated-');
61     $this->copyXmlSchemaFromPlugins('generated-');
62     $ret = $this->callPhing('om', self::CHECK_SCHEMA);
63     $this->cleanup();
64
65     if ($ret)
66     {
67       $this->logSection('autoload', 'reloading autoloading');
68
69       sfSimpleAutoload::getInstance()->reload();
70     }
71
72     return !$ret;
73   }
74 }
75
Note: See TracBrowser for help on using the browser.