Another step on this issue... I've found a workaround: if I set the hydration mode to HYDRATE_NONE, I get the values as expected with several rows in the array. However, it's "not so nice", since I have to do an "array_combine" to get the column names back in the array.
If anyone would have a clue about a way to this more properly, I'd still take it :) Olivier. On Feb 19, 12:33 pm, Olivier <olivier.cha...@gmail.com> wrote: > I've been tracking down this issue a little bit more within Doctrine > code, especially within the hydrateResultSet function of the > Doctrine_Hydrator_Graph object. > There is a loop in this function, and I can see that it does fetch the > two rows of data: > rowData[v] => ([total]=>100, [title] => 'prod_1') > rowData[v] => ([total]=>80, [title] => 'prod_3') > But it seems that, as the query is not set as a "simple query" (there > is a boolean value for that), the second row is not hydrated. > From what I understood (but it would require more time to make it > clear), the hydrator would try to hydrate "subcomponents" (coming from > the relationship between the value_list and product tables), but there > is no such data... > > It might not sound very clear, but as being new to the framework, I > have to agree that it's not that clear for me either... I just hope > this info could help one of the developer to give me a hint about how > to lake the behavior work as expected. > > Olivier. > > On Feb 18, 11:01 pm, Olivier <olivier.cha...@gmail.com> wrote: > > > > > That could have been a reason. Unfortunately, I checked the data and > > they're all good. What I do not understand is that the query executed > > directly on mySQL show ywo records when I get only one via Doctrine... > > > On Feb 18, 9:58 pm, Micha³ Piotrowski <mkkp...@gmail.com> wrote: > > > > Hi, > > > > 2010/2/18 Olivier <olivier.cha...@gmail.com>: > > > > > 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 symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.