My mistake. The sql query actually works. There is no 'AS' explicitly
written, it's the first time I see a query working like this. But it
does, I just didn't copy it correctly. The problem was something else
and it's resolved.

Thx

On Jan 20, 4:10 pm, godbout <guillaume.lecler...@gmail.com> wrote:
> Hi there!
>
> I'm using symfony 1.2 with doctrine.
>
> I'm having trouble trying to customize a filter done by the admin-
> gen.
> I added a sfWidgetFormDoctrineChoice, this works greats. Keys and
> values are ok.
> Then I added to my form filter class a getFields method, and a
> addCodeColumnQuery method.
> My code field comes from another table and I need a inner join to get
> that.
>
> So finally in my addCodeColumnQuery, I add what I need to complete the
> query:
>
> Here's the code:
> ---
> $alias = $query->getRootAlias();
> $query->innerJoin($alias .'.TplProgram T')->addWhere('T.code = "?"',
> $values);
> ---
>
> The sql created by symfony end up being:
> ---
> SELECT COUNT(*) AS num_results FROM (SELECT p.id FROM program_year p
> INNER JOIN tpl_program t ON p.tpl_program_id = t.id WHERE t.code = "?"
> GROUP BY p.id)
> ---
> and that's where the problem is. Mysql refuse to take it as long as I
> don't have a 'AS XXX' at the end of the query.
> How can I add that using the Doctrine_Query type?
>
> Thx a lot in advance!
> Guill
-- 
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.


Reply via email to