Commit 4d367349 authored by Jonathan.Wage's avatar Jonathan.Wage

Moved static methods from Doctrine class to Doctrine_Facade and updated the...

Moved static methods from Doctrine class to Doctrine_Facade and updated the tasks to use Doctrine_Facade.
parent ead84035
This diff is collapsed.
This diff is collapsed.
...@@ -37,6 +37,6 @@ class Doctrine_Task_CreateDb extends Doctrine_Task ...@@ -37,6 +37,6 @@ class Doctrine_Task_CreateDb extends Doctrine_Task
public function execute() public function execute()
{ {
Doctrine::createDatabases($this->getArgument('connection')); Doctrine_Facade::createDatabases($this->getArgument('connection'));
} }
} }
\ No newline at end of file
...@@ -38,6 +38,6 @@ class Doctrine_Task_CreateTables extends Doctrine_Task ...@@ -38,6 +38,6 @@ class Doctrine_Task_CreateTables extends Doctrine_Task
public function execute() public function execute()
{ {
Doctrine::createTablesFromModels($this->getArgument('models_path')); Doctrine_Facade::createTablesFromModels($this->getArgument('models_path'));
} }
} }
\ No newline at end of file
...@@ -38,6 +38,6 @@ class Doctrine_Task_DropDb extends Doctrine_Task ...@@ -38,6 +38,6 @@ class Doctrine_Task_DropDb extends Doctrine_Task
public function execute() public function execute()
{ {
Doctrine::dropDatabases($this->getArgument('connection')); Doctrine_Facade::dropDatabases($this->getArgument('connection'));
} }
} }
\ No newline at end of file
...@@ -39,7 +39,7 @@ class Doctrine_Task_DumpData extends Doctrine_Task ...@@ -39,7 +39,7 @@ class Doctrine_Task_DumpData extends Doctrine_Task
public function execute() public function execute()
{ {
Doctrine::loadModels($this->getArgument('models_path')); Doctrine_Facade::loadModels($this->getArgument('models_path'));
$individualFiles = $this->getArgument('individual_files') ? true:false; $individualFiles = $this->getArgument('individual_files') ? true:false;
...@@ -53,6 +53,6 @@ class Doctrine_Task_DumpData extends Doctrine_Task ...@@ -53,6 +53,6 @@ class Doctrine_Task_DumpData extends Doctrine_Task
} }
} }
Doctrine::dumpData($path, $individualFiles); Doctrine_Facade::dumpData($path, $individualFiles);
} }
} }
\ No newline at end of file
...@@ -39,6 +39,6 @@ class Doctrine_Task_GenerateMigration extends Doctrine_Task ...@@ -39,6 +39,6 @@ class Doctrine_Task_GenerateMigration extends Doctrine_Task
public function execute() public function execute()
{ {
Doctrine::generateMigrationClass($this->getArgument('class_name'), $this->getArgument('migrations_path')); Doctrine_Facade::generateMigrationClass($this->getArgument('class_name'), $this->getArgument('migrations_path'));
} }
} }
\ No newline at end of file
...@@ -38,6 +38,6 @@ class Doctrine_Task_GenerateModelsFromDb extends Doctrine_Task ...@@ -38,6 +38,6 @@ class Doctrine_Task_GenerateModelsFromDb extends Doctrine_Task
public function execute() public function execute()
{ {
Doctrine::generateModelsFromDb($this->getArgument('models_path'), (array) $this->getArgument('connection')); Doctrine_Facade::generateModelsFromDb($this->getArgument('models_path'), (array) $this->getArgument('connection'));
} }
} }
\ No newline at end of file
...@@ -39,6 +39,6 @@ class Doctrine_Task_GenerateModelsFromYaml extends Doctrine_Task ...@@ -39,6 +39,6 @@ class Doctrine_Task_GenerateModelsFromYaml extends Doctrine_Task
public function execute() public function execute()
{ {
Doctrine::generateModelsFromYaml($this->getArgument('yaml_schema_path'), $this->getArgument('models_path')); Doctrine_Facade::generateModelsFromYaml($this->getArgument('yaml_schema_path'), $this->getArgument('models_path'));
} }
} }
\ No newline at end of file
...@@ -39,21 +39,16 @@ class Doctrine_Task_GenerateSql extends Doctrine_Task ...@@ -39,21 +39,16 @@ class Doctrine_Task_GenerateSql extends Doctrine_Task
public function execute() public function execute()
{ {
$sql = Doctrine::generateSqlFromModels($this->getArgument('models_path'));
if (is_dir($this->getArgument('sql_path'))) { if (is_dir($this->getArgument('sql_path'))) {
$path = $this->getArgument('sql_path') . DIRECTORY_SEPARATOR . 'schema.sql'; $path = $this->getArgument('sql_path') . DIRECTORY_SEPARATOR . 'schema.sql';
} else if (is_file($this->getArgument('sql_path'))) { } else if (is_file($this->getArgument('sql_path'))) {
$path = $this->getArgument('sql_path'); $path = $this->getArgument('sql_path');
} else { } else {
throw new Doctrine_Cli_Exception('Invalid sql path.'); throw new Doctrine_Task_Exception('Invalid sql path.');
} }
$build = ''; $sql = Doctrine_Facade::generateSqlFromModels($this->getArgument('models_path'));
foreach ($sql as $query) {
$build .= $query.";\n";
}
file_put_contents($path, $build); file_put_contents($path, $sql);
} }
} }
\ No newline at end of file
...@@ -38,6 +38,6 @@ class Doctrine_Task_GenerateYamlFromDb extends Doctrine_Task ...@@ -38,6 +38,6 @@ class Doctrine_Task_GenerateYamlFromDb extends Doctrine_Task
public function execute() public function execute()
{ {
Doctrine::generateYamlFromDb($this->getArgument('yaml_schema_path')); Doctrine_Facade::generateYamlFromDb($this->getArgument('yaml_schema_path'));
} }
} }
\ No newline at end of file
...@@ -39,6 +39,6 @@ class Doctrine_Task_GenerateYamlFromModels extends Doctrine_Task ...@@ -39,6 +39,6 @@ class Doctrine_Task_GenerateYamlFromModels extends Doctrine_Task
public function execute() public function execute()
{ {
Doctrine::generateYamlFromModels($this->getArgument('yaml_schema_path'), $this->getArgument('models_path')); Doctrine_Facade::generateYamlFromModels($this->getArgument('yaml_schema_path'), $this->getArgument('models_path'));
} }
} }
\ No newline at end of file
...@@ -39,7 +39,7 @@ class Doctrine_Task_LoadData extends Doctrine_Task ...@@ -39,7 +39,7 @@ class Doctrine_Task_LoadData extends Doctrine_Task
public function execute() public function execute()
{ {
Doctrine::loadModels($this->getArgument('models_path')); Doctrine_Facade::loadModels($this->getArgument('models_path'));
Doctrine::loadData($this->getArgument('data_fixtures_path')); Doctrine_Facade::loadData($this->getArgument('data_fixtures_path'));
} }
} }
\ No newline at end of file
...@@ -39,7 +39,7 @@ class Doctrine_Task_LoadDummyData extends Doctrine_Task ...@@ -39,7 +39,7 @@ class Doctrine_Task_LoadDummyData extends Doctrine_Task
public function execute() public function execute()
{ {
Doctrine::loadModels($this->getArgument('models_path')); Doctrine_Facade::loadModels($this->getArgument('models_path'));
Doctrine::loadDummyData($this->getArgument('append') ? true:false, $this->getArgument('num') ? $this->getArgument('num'):5); Doctrine_Facade::loadDummyData($this->getArgument('append') ? true:false, $this->getArgument('num') ? $this->getArgument('num'):5);
} }
} }
\ No newline at end of file
...@@ -38,6 +38,6 @@ class Doctrine_Task_Migrate extends Doctrine_Task ...@@ -38,6 +38,6 @@ class Doctrine_Task_Migrate extends Doctrine_Task
public function execute() public function execute()
{ {
Doctrine::migrate($this->getArgument('version')); Doctrine_Facade::migrate($this->getArgument('version'));
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment