#1674: Incorrect way of arrayToXml conversion
-----------------------------------+----------------------------------------
Reporter: test157 | Owner: jwage
Type: defect | Status: new
Priority: major | Milestone:
Component: Other | Version: 1.0.3
Keywords: | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 0
-----------------------------------+----------------------------------------
Hello,
Thats great ability to convert array to XML directly from
Doctrine_Collection object, like this:
{{{
#!php
<?php
$test = Doctrine_Query::create()->from('Domains d')
->limit(2)
->execute();
echo $test->exportTo('xml');
?>
}}}
But these results are incorrect:
{{{
#!xml
<?xml version="1.0" encoding="utf-8"?>
<data>
<Domains_0>
<id>1</id>
<domain>
domain1.com</domain>
</Domains_0>
<Domains_1>
<id>2</id>
<domain>
domain2.com</domain>
</Domains_1>
</data>
}}}
Correct XML interpretation is:
{{{
#!xml
<?xml version="1.0" encoding="utf-8"?>
<data>
<Domains>
<id>1</id>
<domain>
domain1.com</domain>
</Domains>
<Domains>
<id>2</id>
<domain>
domain2.com</domain>
</Domains>
</data>
}}}
So all we need is just remove Iterator, in this way all Domains for XML
will be one array of objects. And as feature requst maybe it's possible to
set not only root container (data here) but also container for Array
elements? (Domains) here
--
Ticket URL: <
http://trac.doctrine-project.org/ticket/1674>
Doctrine <
http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper