Development

/branches/1.2/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineMigrateTask.class.php

You must first sign up to be able to contribute.

root/branches/1.2/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineMigrateTask.class.php

Revision 14213, 1.7 kB (checked in by Jonathan.Wage, 6 years ago)

[1.2] sfDoctrinePlugin: fixes issue with application option in tasks (closes #5238)

  • Property svn:keywords set to Id Date Author Revision HeadURL
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 sfDoctrineMigrateTask extends sfDoctrineBaseTask
24 {
25   /**
26    * @see sfTask
27    */
28   protected function configure()
29   {
30     $this->addArguments(array(
31       new sfCommandArgument('version', sfCommandArgument::OPTIONAL, 'The version to migrate to', null),
32     ));
33
34     $this->addOptions(array(
35       new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true),
36       new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
37     ));
38
39     $this->aliases = array('doctrine-migrate');
40     $this->namespace = 'doctrine';
41     $this->name = 'migrate';
42     $this->briefDescription = 'Migrates database to current/specified version';
43
44     $this->detailedDescription = <<<EOF
45 The [doctrine:migrate|INFO] task migrates database to current/specified version
46
47   [./symfony doctrine:migrate|INFO]
48 EOF;
49   }
50
51   /**
52    * @see sfTask
53    */
54   protected function execute($arguments = array(), $options = array())
55   {
56     $databaseManager = new sfDatabaseManager($this->configuration);
57
58     $this->callDoctrineCli('migrate', array('version' => $arguments['version']));
59   }
60 }
Note: See TracBrowser for help on using the browser.