sorry, second array should be:
array(
'Result' = array(
0 = array(
'userID' = 5,
'name' = 'bill'
),
1 = array(
'userID' = 25,
'name' = 'jane'
)
)
);
On Sun, Feb 27, 2011 at 11:34 PM, Greg Skerman gsker...@gmail.com wrote:
I'm having a bit of trouble with Set::combine when using it to deal with
xml converted into an array.
I am using the XML utility library, then Set::reverse() to flip it from an
object into an array for easy traversal
The problem is that if a child element only contains 1 record, it is
formatted as such:
array(
'Result' = array(
'userID' = 5,
'name' = 'bill'
)
);
but if the the same child element contains multiple records, it is
formatted as such:
array(
'Result' = array(
1 = array(
'userID' = 5,
'name' = 'bill'
),
2 = array(
'userID' = 25,
'name' = 'jane'
)
)
);
how do I reliably reformat this array using Set::combine() to provide me
with an array whos keys are userID and whos values are name?
I've tried using Path1 as 'Result.{n}.userID' and Path2 as
'Result.{n}.name', however this will not work in the first instance as it is
doesn't contain the {n} path
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at
http://groups.google.com/group/cake-php