I am using Zend_Db_Select currently to retrieve hierarchical data from several joined tables. I need to be able to convert this easily into an array. Short of using a switch statement and listing out all the columns individually in order to sort the data, my thought was that if I could get the table names auto-prepended to the keys in the result array, that would solve my problem. So considering the following (assembled) SQL:
SELECT user.*, contact.* FROM user INNER JOIN contact ON contact.user_id = user.user_id
I would normally get a result array like this:
[username] => 'bob',
[contact_id] => 5,
[user_id] => 2,
[firstname] => 'bob',
[lastname] => 'larsen'
But instead I want this:
[user.user_id] => 2,
[user.username] => 'bob',
[contact.contact_id] => 5,
[contact.firstname] => 'bob',
[contact.lastname] => 'larsen'
Does anyone have an idea how to achieve this?
Thanks!