mysql - Join two Entities in a DQL Query -
i have 2 entities one-to-many relation using annotation in dql query. difference between 2 queries?
1-
select p, c acmestorebundle:product p join p.category c p.id = :id 2-
select p, c acmestorebundle:product p join acmestorebundle:category c on p.categoryid = c.id p.id = :id when check benchmark found second approach take less time. can list pros , cons each way , when each 1 useful?
according official documentation cannot execute second query. haven't tried it's possible? if so, believe, it's bad practice express relations in such manner...
every orm object oriented, , such emphasizes need objects rather ids. second query more native query of relational database join works ids.
Comments
Post a Comment