DQL (Doctrine Query Language) - Introduction.php 1.06 KB
Newer Older
zYne's avatar
zYne committed
1 2 3 4 5 6 7 8 9 10 11
Doctrine Query Language(DQL) is an Object Query Language created for helping users in complex object retrieval.
You should always consider using DQL(or raw SQL) when retrieving relational data efficiently (eg. when fetching users and their phonenumbers).
<br \><br \>
When compared to using raw SQL, DQL has several benefits: <br \>
    <ul>
    <li \>From the start it has been designed to retrieve records(objects) not result set rows
    </ul>
    <ul>
    <li \>DQL understands relations so you don't have to type manually sql joins and join conditions
    </ul>
    <ul>
12 13 14
    <li \>DQL is portable on different databases
    </ul>
    <ul>
zYne's avatar
zYne committed
15 16 17 18
    <li \>DQL has some very complex built-in algorithms like (the record limit algorithm) which can help
    developer to efficiently retrieve objects
    </ul>
    <ul>
19
    <li \>It supports some functions that can save time when dealing with one-to-many, many-to-many relational data with conditional fetching.
zYne's avatar
zYne committed
20 21 22
    </ul>

If the power of DQL isn't enough, you should consider using the rawSql API for object population.
23