Zend_Rest_Server issues and returning arrays

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Zend_Rest_Server issues and returning arrays

Hi All,

Currently, when you return a numeric array, Zend_Rest_Server will turn something like this:

$result = array('A','Bit','Of','Data');

Into something like this:


This works, but can be cumbersome.  What would be nicer is something like this:

<data index="0">A</data>
<data index="1">Bit</data>
<data index="2">Of</data>
<data index="3">Data</data>

The former is easier to iterate over using ActionScript's ObjectProxy and E4X syntax's.  You could just do something like this:

result.data[0]// accesses "A"
result.data[1] // accesses "Bit"

And so forth.  This is easier to iterate over than:

result.key_1 // accesses "A"
result.key_2 // accesses "Bit"

This is because you have iterate from n=0 to n={upperLimit}, and then look in result.data[n], but it's a bit trickier to inspect result.key_{n}.

Anyway, I was wondering there were any plans to add a new, optional behavior to Zend_Rest_Server so it would be like I described above.  I've already implemented this by changing a few lines in an class method that overrides Zend_Rest_Server::_structValue.  See here: