Development

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

You must first sign up to be able to contribute.

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

Revision 23810, 3.5 kB (checked in by Kris.Wallsmith, 5 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  * 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 sfDoctrineBuildAllLoadTask 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-load');
43     $this->namespace = 'doctrine';
44     $this->name = 'build-all-load';
45     $this->briefDescription = 'Generates Doctrine model, SQL, initializes database, and loads fixtures data';
46
47     $this->detailedDescription = <<<EOF
48 The [doctrine:build-all-load|INFO] task is a shortcut for two other tasks:
49
50   [./symfony doctrine:build-all-load|INFO]
51
52 The task is equivalent to:
53
54   [./symfony doctrine:build-all|INFO]
55   [./symfony doctrine:data-load|INFO]
56
57 The task takes an application argument because of the [doctrine:data-load|COMMENT]
58 task. See [doctrine:data-load|COMMENT] help page for more information.
59
60 To bypass the confirmation, you can pass the [no-confirmation|COMMENT]
61 option:
62
63   [./symfony doctrine:build-all-load --no-confirmation|INFO]
64
65 Include the [--migrate|COMMENT] option if you would like to run your project's
66 migrations rather than inserting the Doctrine SQL.
67
68   [./symfony doctrine:build-all-load --migrate|INFO]
69 EOF;
70   }
71
72   /**
73    * @see sfTask
74    */
75   protected function execute($arguments = array(), $options = array())
76   {
77     $task = new sfDoctrineBuildTask($this->dispatcher, $this->formatter);
78     $task->setCommandApplication($this->commandApplication);
79     $task->setConfiguration($this->configuration);
80     $ret = $task->run(array(), array(
81       'no-confirmation' => $options['no-confirmation'],
82       'model'           => true,
83       'forms'           => !$options['skip-forms'],
84       'filters'         => !$options['skip-forms'],
85       'sql'             => true,
86       'and-migrate'     => $options['migrate'],
87       'and-load'        => $options['append'] ? false : (count($options['dir']) ? $options['dir'] : true),
88       'and-append'      => $options['append'] ? (count($options['dir']) ? $options['dir'] : true) : false,
89     ));
90
91     return $ret;
92   }
93 }
94
Note: See TracBrowser for help on using the browser.