Google Groups Home
Help | Sign in
Message from discussion mysql_fetch_assoc
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Johnny  
View profile
 More options 3 Jul, 11:19
From: Johnny <ionut.dumi...@webland.ro>
Date: Thu, 3 Jul 2008 03:19:32 -0700 (PDT)
Local: Thurs 3 Jul 2008 11:19
Subject: mysql_fetch_assoc
hi,

i'm trying to do queries across multiple tables using DQL and need the
results in a mysql_fetch_assoc style.
Doctrine either hydrates the output into nested objects based on the
relations or throws a zero based index array. I tried with all
HYDRATE_ARRAY, HYDRATE_RECORD, HYDRATE_NONE.

is there some way to use such an option with dql?

example: (this was the only way i managed to get my fetch_assoc
vector)

                $results_query=Doctrine_Query::create()
                                                ->setHydrationMode(Doctrine::HYDRATE_ARRAY)
                                                ->select('p.id, p.player_name, b.band_name, u.user_name')
                                                ->from('PlayerResource p')
                                                ->leftJoin('p.Band b')
                                                ->leftJoin('p.User u')
                                                ->execute();

                $results=array();
                $i=0;
                foreach($results_query as $result_query)
                {
                        $results[$i]=array();
                        $results[$i]['id']=$result_query['id'];
                        $results[$i]['player_name']=$result_query['player_name'];
                        $results[$i]['band_name']=$result_query['Band']['band_name'];
                        $results[$i]['user_name']=$result_query['User']['user_name'];
                        $i++;
                }

thanks
Ionut


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google