| 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 sfPropelBuildAllTask extends sfPropelBaseTask |
|---|
| 22 |
{ |
|---|
| 23 |
|
|---|
| 24 |
* @see sfTask |
|---|
| 25 |
*/ |
|---|
| 26 |
protected function configure() |
|---|
| 27 |
{ |
|---|
| 28 |
$this->aliases = array('propel-build-all'); |
|---|
| 29 |
$this->namespace = 'propel'; |
|---|
| 30 |
$this->name = 'build-all'; |
|---|
| 31 |
$this->briefDescription = 'Generates Propel model, SQL and initializes the database'; |
|---|
| 32 |
|
|---|
| 33 |
$this->addOptions(array( |
|---|
| 34 |
new sfCommandOption('skip-forms', 'F', sfCommandOption::PARAMETER_NONE, 'Skip generating forms') |
|---|
| 35 |
)); |
|---|
| 36 |
|
|---|
| 37 |
$this->detailedDescription = <<<EOF |
|---|
| 38 |
The [propel:build-all|INFO] task is a shortcut for three other tasks: |
|---|
| 39 |
|
|---|
| 40 |
[./symfony propel:build-all|INFO] |
|---|
| 41 |
|
|---|
| 42 |
The task is equivalent to: |
|---|
| 43 |
|
|---|
| 44 |
[./symfony propel:build-model|INFO] |
|---|
| 45 |
[./symfony propel:build-sql|INFO] |
|---|
| 46 |
[./symfony propel:build-forms|INFO] |
|---|
| 47 |
[./symfony propel:insert-sql|INFO] |
|---|
| 48 |
|
|---|
| 49 |
See those three tasks help page for more information. |
|---|
| 50 |
EOF; |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
* @see sfTask |
|---|
| 55 |
*/ |
|---|
| 56 |
protected function execute($arguments = array(), $options = array()) |
|---|
| 57 |
{ |
|---|
| 58 |
$buildModel = new sfPropelBuildModelTask($this->dispatcher, $this->formatter); |
|---|
| 59 |
$buildModel->setCommandApplication($this->commandApplication); |
|---|
| 60 |
$buildModel->run(); |
|---|
| 61 |
|
|---|
| 62 |
$buildSql = new sfPropelBuildSqlTask($this->dispatcher, $this->formatter); |
|---|
| 63 |
$buildSql->setCommandApplication($this->commandApplication); |
|---|
| 64 |
$buildSql->run(); |
|---|
| 65 |
|
|---|
| 66 |
if (!$options['skip-forms']) |
|---|
| 67 |
{ |
|---|
| 68 |
$buildForms = new sfPropelBuildFormsTask($this->dispatcher, $this->formatter); |
|---|
| 69 |
$buildForms->setCommandApplication($this->commandApplication); |
|---|
| 70 |
$buildForms->run(); |
|---|
| 71 |
} |
|---|
| 72 |
|
|---|
| 73 |
$insertSql = new sfPropelInsertSqlTask($this->dispatcher, $this->formatter); |
|---|
| 74 |
$insertSql->setCommandApplication($this->commandApplication); |
|---|
| 75 |
$insertSql->run(); |
|---|
| 76 |
} |
|---|
| 77 |
} |
|---|
| 78 |
|
|---|