Development

/branches/1.3/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineInsertSqlTask.class.php

You must first sign up to be able to contribute.

root/branches/1.3/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineInsertSqlTask.class.php

Revision 27942, 1.9 kB (checked in by Kris.Wallsmith, 5 years ago)

[1.3, 1.4] fixed output of doctrine:insert-sql task (closes #8008)

  • 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) Fabien Potencier <fabien.potencier@symfony-project.com>
6  * (c) Jonathan H. Wage <jonwage@gmail.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 require_once(dirname(__FILE__).'/sfDoctrineBaseTask.class.php');
13
14 /**
15  * Inserts SQL for current model.
16  *
17  * @package    symfony
18  * @subpackage doctrine
19  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
20  * @author     Jonathan H. Wage <jonwage@gmail.com>
21  * @version    SVN: $Id$
22  */
23 class sfDoctrineInsertSqlTask extends sfDoctrineBaseTask
24 {
25   /**
26    * @see sfTask
27    */
28   protected function configure()
29   {
30     $this->addOptions(array(
31       new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true),
32       new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
33     ));
34
35     $this->aliases = array('doctrine-insert-sql');
36     $this->namespace = 'doctrine';
37     $this->name = 'insert-sql';
38     $this->briefDescription = 'Inserts SQL for current model';
39
40     $this->detailedDescription = <<<EOF
41 The [doctrine:insert-sql|INFO] task creates database tables:
42
43   [./symfony doctrine:insert-sql|INFO]
44
45 The task connects to the database and creates tables for all the
46 [lib/model/doctrine/*.class.php|COMMENT] files.
47 EOF;
48   }
49
50   /**
51    * @see sfTask
52    */
53   protected function execute($arguments = array(), $options = array())
54   {
55     $this->logSection('doctrine', 'creating tables');
56
57     $databaseManager = new sfDatabaseManager($this->configuration);
58     $config = $this->getCliConfig();
59
60     Doctrine_Core::loadModels($config['models_path'], Doctrine_Core::MODEL_LOADING_CONSERVATIVE);
61     Doctrine_Core::createTablesFromArray(Doctrine_Core::getLoadedModels());
62
63     $this->logSection('doctrine', 'created tables successfully');
64   }
65 }
66
Note: See TracBrowser for help on using the browser.