Hello everyone,


I'm facing a problem with Doctrine 2 Query generator.

When I'm trying to generate a query like this one :


SELECT 
>   v.*, 
>   p.ID_PROFIL AS ID_PROFIL, 
> FROM 
>   VARIABLE v 
>   LEFT JOIN variable_profil vp ON v.ID_VARIABLE = vp.ID_VARIABLE 
>   LEFT JOIN PROFIL p ON p.ID_PROFIL = vp.ID_PROFIL 
> ORDER BY 
>   v.MNEMONIQUE DESC


And Doctrine generate the following querieS (not that there is more than one 
query...)


SELECT 
>   DISTINCT ID_VARIABLE3 
> FROM 
>   (
>     SELECT 
>       v.LIBELLE AS LIBELLE0, 
>       v.MNEMONIQUE AS MNEMONIQUE1, 
>       v.ID_VARIABLE AS ID_VARIABLE2, 
>       p.ID_PROFIL AS ID_PROFIL3 
>     FROM 
>       VARIABLE v 
>       LEFT JOIN variable_profil vp ON v.ID_VARIABLE = vp.ID_VARIABLE 
>       LEFT JOIN PROFIL p ON p.ID_PROFIL = vp.ID_PROFIL  
>     ORDER BY 
>       v.MNEMONIQUE DESC
>   ) dctrn_result

SELECT 
>   v.LIBELLE AS LIBELLE0, 
>   v.MNEMONIQUE AS MNEMONIQUE1, 
>   v.ID_VARIABLE AS ID_VARIABLE2, 
>   p.ID_PROFIL AS ID_PROFIL3 
> FROM 
>   VARIABLE v 
>   LEFT JOIN variable_profil vp ON v.ID_VARIABLE = vp.ID_VARIABLE 
>   LEFT JOIN PROFIL p ON p.ID_PROFIL = vp.ID_PROFIL  
> WHERE 
>   v.ID_VARIABLE IN (<IDs fetched by the previous query>) 
> ORDER BY 
>   v.MNEMONIQUE DESC



I cant understand why there is more than 1 query generated.

Does someone know why, *and how to avoid this* ?

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to