Development

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

You must first sign up to be able to contribute.

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

Revision 23810, 3.3 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 Databases, Creates Databases, Generates Doctrine model, SQL, initializes database, and load data.
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  * @deprecated Use doctrine:build instead
24  */
25 class sfDoctrineBuildAllReloadTask extends sfDoctrineBaseTask
26 {
27   /**
28    * @see sfTask
29    */
30   protected function configure()
31   {
32     $this->addOptions(array(
33       new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true),
34       new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
35       new sfCommandOption('no-confirmation', null, sfCommandOption::PARAMETER_NONE, 'Do not ask for confirmation'),
36       new sfCommandOption('skip-forms', 'F', sfCommandOption::PARAMETER_NONE, 'Skip generating forms'),
37       new sfCommandOption('migrate', null, sfCommandOption::PARAMETER_NONE, 'Migrate instead of reset the database'),
38       new sfCommandOption('dir', null, sfCommandOption::PARAMETER_REQUIRED | sfCommandOption::IS_ARRAY, 'The directories to look for fixtures'),
39       new sfCommandOption('append', null, sfCommandOption::PARAMETER_NONE, 'Don\'t delete current data in the database'),
40     ));
41
42     $this->aliases = array('doctrine-build-all-reload');
43     $this->namespace = 'doctrine';
44     $this->name = 'build-all-reload';
45     $this->briefDescription = 'Generates Doctrine model, SQL, initializes database, and load data';
46
47     $this->detailedDescription = <<<EOF
48 The [doctrine:build-all-reload|INFO] task is a shortcut for five other tasks:
49
50   [./symfony doctrine:build-all-reload|INFO]
51
52 The task is equivalent to:
53
54   [./symfony doctrine:drop-db|INFO]
55   [./symfony doctrine:build-db|INFO]
56   [./symfony doctrine:build-model|INFO]
57   [./symfony doctrine:insert-sql|INFO]
58   [./symfony doctrine:data-load|INFO]
59
60 Include the [--migrate|COMMENT] option if you would like to run your project's
61 migrations rather than inserting the Doctrine SQL.
62
63   [./symfony doctrine:build-all-reload --migrate|INFO]
64 EOF;
65   }
66
67   /**
68    * @see sfTask
69    */
70   protected function execute($arguments = array(), $options = array())
71   {
72     $task = new sfDoctrineBuildTask($this->dispatcher, $this->formatter);
73     $task->setCommandApplication($this->commandApplication);
74     $task->setConfiguration($this->configuration);
75     $ret = $task->run(array(), array(
76       'no-confirmation' => $options['no-confirmation'],
77       'db'              => true,
78       'model'           => true,
79       'forms'           => !$options['skip-forms'],
80       'filters'         => !$options['skip-forms'],
81       'sql'             => true,
82       'and-migrate'     => $options['migrate'],
83       'and-load'        => $options['append'] ? false : (count($options['dir']) ? $options['dir'] : true),
84       'and-append'      => $options['append'] ? (count($options['dir']) ? $options['dir'] : true) : false,
85     ));
86
87     return $ret;
88   }
89 }
90
Note: See TracBrowser for help on using the browser.