| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
require_once(dirname(__FILE__).'/sfPropelBaseTask.class.php'); |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
class sfPropelBuildAllLoadTask extends sfPropelBaseTask |
|---|
| 22 |
{ |
|---|
| 23 |
|
|---|
| 24 |
* @see sfTask |
|---|
| 25 |
*/ |
|---|
| 26 |
protected function configure() |
|---|
| 27 |
{ |
|---|
| 28 |
$this->addArguments(array( |
|---|
| 29 |
new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'), |
|---|
| 30 |
)); |
|---|
| 31 |
|
|---|
| 32 |
$this->addOptions(array( |
|---|
| 33 |
new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), |
|---|
| 34 |
new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'), |
|---|
| 35 |
new sfCommandOption('skip-forms', 'F', sfCommandOption::PARAMETER_NONE, 'Skip generating forms') |
|---|
| 36 |
)); |
|---|
| 37 |
|
|---|
| 38 |
$this->aliases = array('propel-build-all-load'); |
|---|
| 39 |
$this->namespace = 'propel'; |
|---|
| 40 |
$this->name = 'build-all-load'; |
|---|
| 41 |
$this->briefDescription = 'Generates Propel model, SQL, initializes database, and load data'; |
|---|
| 42 |
|
|---|
| 43 |
$this->detailedDescription = <<<EOF |
|---|
| 44 |
The [propel:build-all-load|INFO] task is a shortcut for four other tasks: |
|---|
| 45 |
|
|---|
| 46 |
[./symfony propel:build-all-load frontend|INFO] |
|---|
| 47 |
|
|---|
| 48 |
The task is equivalent to: |
|---|
| 49 |
|
|---|
| 50 |
[./symfony propel:build-all|INFO] |
|---|
| 51 |
[./symfony propel:data-load frontend|INFO] |
|---|
| 52 |
|
|---|
| 53 |
The task takes an application argument because of the [propel:data-load|COMMENT] |
|---|
| 54 |
task. See [propel:data-load|COMMENT] help page for more information. |
|---|
| 55 |
EOF; |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
* @see sfTask |
|---|
| 60 |
*/ |
|---|
| 61 |
protected function execute($arguments = array(), $options = array()) |
|---|
| 62 |
{ |
|---|
| 63 |
|
|---|
| 64 |
$databaseManager = new sfDatabaseManager($this->configuration); |
|---|
| 65 |
require_once sfConfig::get('sf_symfony_lib_dir').'/plugins/sfPropelPlugin/lib/propel/sfPropelAutoload.php'; |
|---|
| 66 |
|
|---|
| 67 |
$buildAll = new sfPropelBuildAllTask($this->dispatcher, $this->formatter); |
|---|
| 68 |
$buildAll->setCommandApplication($this->commandApplication); |
|---|
| 69 |
$buildAll->run(array(), $options['skip-forms'] ? array('--skip-forms') : array()); |
|---|
| 70 |
|
|---|
| 71 |
$loadData = new sfPropelLoadDataTask($this->dispatcher, $this->formatter); |
|---|
| 72 |
$loadData->setCommandApplication($this->commandApplication); |
|---|
| 73 |
|
|---|
| 74 |
$loadData->run(array('application' => $arguments['application']), array('--env='.$options['env'], '--connection='.$options['connection'])); |
|---|
| 75 |
} |
|---|
| 76 |
} |
|---|
| 77 |
|
|---|