When using the QueryBuilder, it makes the selection more easier sometimes. 
However, sometimes not.

Consider the following tables

table member(
>   `id` int primary key auto_increment,
>   `name` varchar(255)
> )
> table program(
>   `id` int primary key auto_increment,
> )
> table program_info(
>   `id` primary key auto_increment,
>   `program_id` reference to (program.id)
>   `program_name`
>   `charset_id`
> )
> table program_invoke(
>   `id` primary key auto_increment,
>   `member_id` reference to (member.id)
>   `program_id` reference to (program_id)
> )


The query is built to select the program name which a member has been 
invoked.
Since there are no relationship between program_info and program_invoke, so 
the DQL has been write as

$query_builder->select(pinfo.name)->from(program_invoke)->join('member','m')->join('m.program','p')->join('p.info','pinfo')->where()

Comparing with the native query, which is

select pinfo from program_invoke invoke 
> inner join program_info pinfo on pinfo.program_id = invoke.program_id
> inner join member m on m.id = invoke.member_id


The DQL have joined one more table. In this case, The QueryBuilder since 
less efficient than native query.

How can I make the QueryBuilder more efficient in this case. Or should I 
specify which case should use QueryBuilder and which case should use native 
query?

-- 
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