Hi, 2010/2/18 Olivier <[email protected]>: > Hello everyone, > > I'm a little new to Symfony, I've been browsing the user list, but did > not find an answer to my issue. > I'm using symfony version 1.4 with Doctrine. > I have a query that I create using Doctrine, with the following code: > $q = Doctrine_Query::create() > ->from('ValueList v') > ->select('SUM(v.value) as total, p.name as title) > ->leftJoin('v.Products p) > ->where('v.account_id = ?',$account) > ->groupBy('v.product_id'); > return $q->setHydrationMode(Doctrine::HYDRATE_ARRAY) > ->execute(); > > Using the WebDebugToolBar, I get the query: > SELECT SUM(v.value) AS v__0, p.name AS v__1 FROM value_list v LEFT > JOIN product p ON v.product_id = p.id WHERE (v.account_id = '1') GROUP > BY v.product_id > > When running the above query on my test data (for example using > phpmyadmin), I get two records as a result. Within symfony/doctrine, > however, the array count is 1. I've tried changing the hydration mode > but it did not change this result. > However, if I remove the 'leftJoin' from the doctrine code (selecting > for example v.product_id instead of p.name), I get the two lines as > expected. > > Could someone shed a light on this? It's puzzled me for some time. >
I'm guessing that you don't have v.product_id in value_list for one record. Regards, Michal -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
