Development

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

You must first sign up to be able to contribute.

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

Revision 23810, 2.7 kB (checked in by Kris.Wallsmith, 4 years ago)

[1.3] set svn:eol-style property to native and svn:keywords property to Id on all .php files

  • 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  * Drops database, recreates it, inserts the sql and loads the data fixtures
16  *
17  * @package    symfony
18  * @subpackage doctrine
19  * @author     Jonathan H. Wage <jonwage@gmail.com>
20  * @version    SVN: $Id$
21  *
22  * @deprecated Use doctrine:build instead
23  */
24 class sfDoctrineReloadDataTask extends sfDoctrineBaseTask
25 {
26   /**
27    * @see sfTask
28    */
29   protected function configure()
30   {
31     $this->addOptions(array(
32       new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true),
33       new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
34       new sfCommandOption('no-confirmation', null, sfCommandOption::PARAMETER_NONE, 'Do not ask for confirmation'),
35       new sfCommandOption('dir', null, sfCommandOption::PARAMETER_REQUIRED | sfCommandOption::IS_ARRAY, 'The directories to look for fixtures'),
36       new sfCommandOption('migrate', null, sfCommandOption::PARAMETER_NONE, 'Migrate instead of reset the database'),
37       new sfCommandOption('append', null, sfCommandOption::PARAMETER_NONE, 'Don\'t delete current data in the database'),
38     ));
39
40     $this->aliases = array('doctrine-reload-data');   
41     $this->namespace = 'doctrine';
42     $this->name = 'reload-data';
43
44     $this->briefDescription = 'Reloads databases and fixtures for your project';
45
46     $this->detailedDescription = <<<EOF
47 The [doctrine:reload-data|INFO] task drops the database, recreates it and loads
48 fixtures:
49
50   [php symfony doctrine:reload-data|INFO]
51  
52 The task is equivalent to:
53
54   [./symfony doctrine:drop-db|INFO]
55   [./symfony doctrine:build-db|INFO]
56   [./symfony doctrine:insert-sql|INFO]
57   [./symfony doctrine:data-load|INFO] 
58 EOF;
59   }
60
61   protected function execute($arguments = array(), $options = array())
62   {
63     $task = new sfDoctrineBuildTask($this->dispatcher, $this->formatter);
64     $task->setCommandApplication($this->commandApplication);
65     $task->setConfiguration($this->configuration);
66     $ret = $task->run(array(), array(
67       'no-confirmation' => $options['no-confirmation'],
68       'db'              => true,
69       'and-migrate'     => $options['migrate'],
70       'and-load'        => $options['append'] ? false : (count($options['dir']) ? $options['dir'] : true),
71       'and-append'      => $options['append'] ? (count($options['dir']) ? $options['dir'] : true) : false,
72     ));
73
74     return $ret;
75   }
76 }
77
Note: See TracBrowser for help on using the browser.