From 13d781cb688739c555bd7cd95ac0deca2c8156f6 Mon Sep 17 00:00:00 2001 From: "Jonathan.Wage" Date: Thu, 13 Sep 2007 19:25:52 +0000 Subject: [PATCH] Added aliases. --- lib/Doctrine/Export/Schema/Xml.php | 19 +------------------ lib/Doctrine/Export/Schema/Yml.php | 2 +- lib/Doctrine/Parser.php | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/lib/Doctrine/Export/Schema/Xml.php b/lib/Doctrine/Export/Schema/Xml.php index fd062550f..8af837a04 100644 --- a/lib/Doctrine/Export/Schema/Xml.php +++ b/lib/Doctrine/Export/Schema/Xml.php @@ -41,24 +41,7 @@ class Doctrine_Export_Schema_Xml extends Doctrine_Export_Schema */ public function build($array) { - $xml = new SimpleXMLElement(); - - foreach ($array as $tableName => $fields) { - $table = $xml->addChild('table'); - $name = $table->addChild('name', $tableName); - $declaration = $table->addChild('declaration'); - - foreach ($fields as $fieldName => $properties) { - $field = $declaration->addChild('field'); - $field->addChild('name', $fieldName); - - foreach ($properties as $key => $value) { - $field->addChild($key, $value); - } - } - } - - return $xml->asXml(); + return Doctrime_Parser::dump($array, null, 'xml'); } /** diff --git a/lib/Doctrine/Export/Schema/Yml.php b/lib/Doctrine/Export/Schema/Yml.php index 271f1d496..e698e4f50 100644 --- a/lib/Doctrine/Export/Schema/Yml.php +++ b/lib/Doctrine/Export/Schema/Yml.php @@ -41,7 +41,7 @@ class Doctrine_Export_Schema_Yml extends Doctrine_Export_Schema */ public function build($array) { - return var_dump($array); + return Doctrime_Parser::dump($array, null, 'yml'); } /** diff --git a/lib/Doctrine/Parser.php b/lib/Doctrine/Parser.php index d4567022a..04324575f 100644 --- a/lib/Doctrine/Parser.php +++ b/lib/Doctrine/Parser.php @@ -54,4 +54,24 @@ abstract class Doctrine_Parser return $parser->dumpData($array, $path); } + + static public function loadXml($path) + { + return self::load($path, 'xml'); + } + + static public function dumpXml($array, $path = null) + { + return self::dump($array, $path, 'xml'); + } + + static public function loadYml($path) + { + return self::load($path, 'yml'); + } + + static public function dumpYml($array, $path = null) + { + return self::dump($array, $path, 'yml'); + } } \ No newline at end of file