From 999aeff0de7072659b55cfaf9617d587026720cb Mon Sep 17 00:00:00 2001 From: meus Date: Sun, 1 Jul 2007 10:46:24 +0000 Subject: [PATCH] added new xml options record_name and collection_name so that you can override default behavior if wanted --- lib/Doctrine/Lib.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/Doctrine/Lib.php b/lib/Doctrine/Lib.php index ccad93e8f..daa0458a5 100644 --- a/lib/Doctrine/Lib.php +++ b/lib/Doctrine/Lib.php @@ -86,6 +86,13 @@ class Doctrine_Lib public static function getCollectionAsXml(Doctrine_Collection $collection, SimpleXMLElement $incomming_xml = null){ $collectionName = Doctrine_Lib::plurelize($collection->getTable()->tableName); + if($collection->count != 0){ + $record = $collection[0]; + $xml_options = $record->option("xml"); + if(isset($xml_options["collection_name"])){ + $collectionName = $xml_options["collection_name"]; + } + } if ( ! isset($incomming_xml)) { $new_xml_string = "<" . $collectionName . ">"; @@ -131,6 +138,9 @@ class Doctrine_Lib $xml->addChild($pk_field,$pk_value); } $xml_options = $record->option("xml"); + if(isset($xml_options["record_name"])){ + $recordname = $xml_options["record_name"]; + } foreach ($record->getData() as $field => $value) { if ((isset($xml_options["ignore_fields"]) && !in_array($field, $xml_options["ignore_fields"])) || !isset($xml_options["ignore_fields"])) { if ($value instanceOf Doctrine_Null) {