Re: DB_DataObject & XML Renderer
| From: | Justin Patrin | Date: | Mon, 16 Oct 2006 04:50:55 +0000 |
| Subject: | Re: DB_DataObject & XML Renderer | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25459@lists.php.net to get a copy of this message | ||
On 10/15/06, Chris Boget <chris.boget@wild.net> wrote:
I don't think this is possible. I've tried but couldn't get it to work. I'm hoping that I can get confirmation that I'm chasing my tail or if, in fact, what I'm trying to do will work.DB_DataObject doesn't have an XML renderer. In fact, it has no renderers ar all. Perhaps you mean Structures_DataGrid.
I have 2 tables, one having a 1-M relationship with the other. If I run a query like this: SELECT table1.name, table2.orderItem, table2.orderQuantity, table2.orderAmount FROM table1 INNER JOIN table2 ON table2.table1Id = table1.id and run it through the XML Renderer I get something that looks like this: <root> <row>Structures_DataGrid outputs a grid. It you want a more complicated structure you'll probably have to do it yourself. SDG knows nothing of the JOIN you're doing. -- Justin Patrin<name>bob</name> <orderItem>Item 1</orderItem> <orderQuantity>5</orderQuantity> <orderAmount>100</orderAmount></row> <row><name>bob</name> <orderItem>Item 2</orderItem> <orderQuantity>5</orderQuantity> <orderAmount>100</orderAmount></row> <row><name>bob</name> <orderItem>Item 3</orderItem> <orderQuantity>5</orderQuantity> <orderAmount>100</orderAmount></row> </root> If there are 3 rows in table2. What I'm hoping I can get out of it is something that looks like this: <root> <row><name>bob</name> <linkedrows> <row> <orderItem>Item 1</orderItem> <orderQuantity>5</orderQuantity> <orderAmount>100</orderAmount> </row> <row> <orderItem>Item 2</orderItem> <orderQuantity>5</orderQuantity> <orderAmount>100</orderAmount> </row> <row> <orderItem>Item 3</orderItem> <orderQuantity>5</orderQuantity> <orderAmount>100</orderAmount> </row> </linkedrows></root> Is that possible? Or am I going to have to output the XML on my own?