From 3df29f7d012672c9127245e3b48bfc6409a45ca3 Mon Sep 17 00:00:00 2001 From: "Jonathan.Wage" Date: Thu, 20 Sep 2007 16:11:59 +0000 Subject: [PATCH] A few tweaks. --- lib/Doctrine/Data/Export.php | 4 ++-- lib/Doctrine/Export/Schema/Xml.php | 2 +- lib/Doctrine/Export/Schema/Yml.php | 2 +- lib/Doctrine/Parser.php | 2 +- manual/new/docs/en/file-parser.txt | 6 +++--- manual/new/docs/en/migration.txt | 14 +++++++------- tests/MigrationTestCase.php | 14 +++++++------- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/Doctrine/Data/Export.php b/lib/Doctrine/Data/Export.php index a248cc6c1..8da5fdec3 100644 --- a/lib/Doctrine/Data/Export.php +++ b/lib/Doctrine/Data/Export.php @@ -98,14 +98,14 @@ class Doctrine_Data_Export extends Doctrine_Data } foreach ($data as $className => $classData) { - Doctrine_Parser::dump($classData->toArray(), $directory.DIRECTORY_SEPARATOR.$className.'.'.$format, $format); + Doctrine_Parser::dump($classData->toArray(), $format, $directory.DIRECTORY_SEPARATOR.$className.'.'.$format); } } else { if (is_dir($directory)) { throw new Doctrine_Data_Exception('You must specify the path to a '.$format.' file to export. You specified a directory.'); } - return Doctrine_Parser::dump($data, $directory, $format); + return Doctrine_Parser::dump($data, $format, $directory); } } /** diff --git a/lib/Doctrine/Export/Schema/Xml.php b/lib/Doctrine/Export/Schema/Xml.php index 343bfd83e..d5d90493e 100644 --- a/lib/Doctrine/Export/Schema/Xml.php +++ b/lib/Doctrine/Export/Schema/Xml.php @@ -41,6 +41,6 @@ class Doctrine_Export_Schema_Xml extends Doctrine_Export_Schema */ public function build($array) { - return Doctrine_Parser::dumpXml($array, null); + return Doctrine_Parser::dump($array, 'yml'); } } \ No newline at end of file diff --git a/lib/Doctrine/Export/Schema/Yml.php b/lib/Doctrine/Export/Schema/Yml.php index 6535fe9d4..557c23d54 100644 --- a/lib/Doctrine/Export/Schema/Yml.php +++ b/lib/Doctrine/Export/Schema/Yml.php @@ -41,6 +41,6 @@ class Doctrine_Export_Schema_Yml extends Doctrine_Export_Schema */ public function build($array) { - return Doctrine_Parser::dumpYml($array, null); + return Doctrine_Parser::dump($array, 'yml'); } } \ No newline at end of file diff --git a/lib/Doctrine/Parser.php b/lib/Doctrine/Parser.php index 4beb0f163..a9548eaf9 100644 --- a/lib/Doctrine/Parser.php +++ b/lib/Doctrine/Parser.php @@ -94,7 +94,7 @@ abstract class Doctrine_Parser * @return void * @author Jonathan H. Wage */ - static public function dump($array, $path = null, $type = 'xml') + static public function dump($array, $type = 'xml', $path = null) { $parser = self::getParser($type); diff --git a/manual/new/docs/en/file-parser.txt b/manual/new/docs/en/file-parser.txt index 4f9ea39df..cd1c41db1 100644 --- a/manual/new/docs/en/file-parser.txt +++ b/manual/new/docs/en/file-parser.txt @@ -8,7 +8,7 @@ Dumping array to yml variable $array = array('test' => array('key' => 'value'), 'test2' => 'test'); // Dump the array to yml and return, set to $yml(does not write to file). Replace null with a path to a yml file if you wish to write to disk -$yml = Doctrine_Parser::dump($array, null, 'yml'); +$yml = Doctrine_Parser::dump($array, 'yml'); $yml would contain the following @@ -26,7 +26,7 @@ Dumping array to yml file $array = array('test' => array('key' => 'value'), 'test2' => 'test'); // Dump the above array to test.yml using yml parser -Doctrine_Parser::dump($array, 'test.yml', 'yml'); +Doctrine_Parser::dump($array, 'yml', 'test.yml'); A file named test.yml would be created and would contain the following @@ -45,7 +45,7 @@ Loading and parsing data from a yml file to a php array $array = array('test' => array('key' => 'value'), 'test2' => 'test'); // We dump the above array to test.yml using the yml parser dumper -Doctrine_Parser::dump($array, 'test.yml', 'yml'); +Doctrine_Parser::dump($array, 'yml', 'test.yml'); // Now we reload that dumped yaml file back to the original array format using the yml parser loder $array = Doctrine_Parser::load('test.yml', 'yml'); diff --git a/manual/new/docs/en/migration.txt b/manual/new/docs/en/migration.txt index e06bbc7a4..6a317278a 100644 --- a/manual/new/docs/en/migration.txt +++ b/manual/new/docs/en/migration.txt @@ -5,7 +5,7 @@ The Doctrine Migration tools allow you to migrate databases and it issues alter Migration classes consist of a simple class that extends from Doctrine_Migration. You can define a public up() and down() method that is meant for doing and undoing changes to a database for that migration step. -class MigrationTestTable extends Doctrine_Record +class MigrationTest extends Doctrine_Record { public function setTableDefinition() { @@ -17,12 +17,12 @@ class Migration2 extends Doctrine_Migration { public function up() { - $this->createTable('migration_test_table', array('field1' => array('type' => 'string'))); + $this->createTable('migration_test', array('field1' => array('type' => 'string'))); } public function down() { - $this->dropTable('migration_test_table'); + $this->dropTable('migration_test'); } } @@ -30,12 +30,12 @@ class Migration3 extends Doctrine_Migration { public function up() { - $this->addColumn('migration_test_table', 'field1', 'string'); + $this->addColumn('migration_test', 'field1', 'string'); } public function down() { - $this->renameColumn('migration_test_table', 'field1', 'field2'); + $this->renameColumn('migration_test', 'field1', 'field2'); } } @@ -43,12 +43,12 @@ class Migration4 extends Doctrine_Migration { public function up() { - $this->changeColumn('migration_test_table', 'field1', 'integer'); + $this->changeColumn('migration_test', 'field1', 'integer'); } public function down() { - $this->changeColumn('migration_test_table', 'field1', 'string'); + $this->changeColumn('migration_test', 'field1', 'string'); } } diff --git a/tests/MigrationTestCase.php b/tests/MigrationTestCase.php index bfebc7400..3318a33c2 100644 --- a/tests/MigrationTestCase.php +++ b/tests/MigrationTestCase.php @@ -47,7 +47,7 @@ class Doctrine_Migration_TestCase extends Doctrine_UnitTestCase } } -class MigrationTestTable extends Doctrine_Record +class MigrationTest extends Doctrine_Record { public function setTableDefinition() { @@ -59,12 +59,12 @@ class Migration2 extends Doctrine_Migration { public function up() { - $this->createTable('migration_test_table', array('field1' => array('type' => 'string'))); + $this->createTable('migration_test', array('field1' => array('type' => 'string'))); } public function down() { - $this->dropTable('migration_test_table'); + $this->dropTable('migration_test'); } } @@ -72,12 +72,12 @@ class Migration3 extends Doctrine_Migration { public function up() { - $this->addColumn('migration_test_table', 'field1', 'string'); + $this->addColumn('migration_test', 'field1', 'string'); } public function down() { - $this->renameColumn('migration_test_table', 'field1', 'field2'); + $this->renameColumn('migration_test', 'field1', 'field2'); } } @@ -85,11 +85,11 @@ class Migration4 extends Doctrine_Migration { public function up() { - $this->changeColumn('migration_test_table', 'field1', 'integer'); + $this->changeColumn('migration_test', 'field1', 'integer'); } public function down() { - $this->changeColumn('migration_test_table', 'field1', 'string'); + $this->changeColumn('migration_test', 'field1', 'string'); } } \ No newline at end of file