[Doctrine] #1674: Incorrect way of arrayToXml conversion

4 views
Skip to first unread message

Doctrine

unread,
Nov 18, 2008, 5:44:53 AM11/18/08
to doctri...@googlegroups.com
#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

Doctrine

unread,
Nov 18, 2008, 5:56:10 AM11/18/08
to doctri...@googlegroups.com
#1674: Incorrect way of arrayToXml conversion
----------------------+-----------------------------------------------------
Reporter: test157 | Owner: jwage
Type: defect | Status: new
Priority: major | Milestone:
Component: Other | Version: 1.0.3
Resolution: | Keywords:
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
----------------------+-----------------------------------------------------
Comment (by test157):

And the same is valid for all Parser_Xml Function - which returns data
like this:
{{{
#!xml
<?xml version="1.0" encoding="utf-8"?>
<data>
<0>
<id>1</id>
<domain>domain1.com</domain>
</0>
<1>
<id>2</id>
<domain>domain2.com</domain>
</1>
</data>
}}}
So we need to set group name instead of iterators values manually or in
auto mode like now is in exportTo function

--
Ticket URL: <http://trac.doctrine-project.org/ticket/1674#comment:1>

Doctrine

unread,
Nov 19, 2008, 12:51:54 AM11/19/08
to doctri...@googlegroups.com
#1674: Incorrect way of arrayToXml conversion
----------------------+-----------------------------------------------------
Reporter: test157 | Owner: jwage
Type: defect | Status: new
Priority: major | Milestone:
Component: Other | Version: 1.0.3
Resolution: | Keywords:
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
----------------------+-----------------------------------------------------
Comment (by test157):

and another variant for smaller, footprint another XML variant also
possible:
{{{
#!xml
<?xml version="1.0" encoding="utf-8"?>
<data>
<Domains id="1" domain="domain1.com" />
<Domains id="2" domain="domain2.com" />
</data>
}}}
It's very important if we are talking about Ajax/Flex applications -
smaller footprint, faster response.

What you think if for exportTo() instead of string variable - what defines
format, we could send Object with Output format settings?

--
Ticket URL: <http://trac.doctrine-project.org/ticket/1674#comment:2>

Doctrine

unread,
Nov 20, 2008, 3:46:10 PM11/20/08
to doctri...@googlegroups.com
#1674: Incorrect way of arrayToXml conversion
----------------------+-----------------------------------------------------
Reporter: test157 | Owner: jwage
Type: defect | Status: new
Priority: major | Milestone: 1.1.0
Component: Other | Version: 1.0.3
Resolution: | Keywords:
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
----------------------+-----------------------------------------------------
Changes (by jwage):

* milestone: => 1.1.0

--
Ticket URL: <http://trac.doctrine-project.org/ticket/1674#comment:3>

Doctrine

unread,
Dec 1, 2008, 6:01:09 PM12/1/08
to doctri...@googlegroups.com
#1674: Incorrect way of arrayToXml conversion
-----------------------------------+----------------------------------------
Reporter: test157 | Owner: jwage
Type: defect | Status: new
Priority: major | Milestone: 1.2.0
Component: Other | Version: 1.0.3
Keywords: | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 0
-----------------------------------+----------------------------------------
Changes (by jwage):

* milestone: 1.1.0 => 1.2.0


--
Ticket URL: <http://trac.doctrine-project.org/ticket/1674#comment:4>

Reply all
Reply to author
Forward
0 new messages