**Helping the DQL parser**
There are two possible ways when it comes to using DQL. The first one is writing the plain DQL queries and passing them to Doctrine_Connection::query($dql). The second one is to use a Doctrine_Query object and its fluent interface. The latter should be preferred for all but very simple queries. The reason is that using the Doctrine_Query object and it's methods makes the life of the DQL parser a little bit easier. It reduces the amount of query parsing that needs to be done and is therefore faster.
**Efficient relation handling**
When you want to add a relation between two components you should **NOT** do something like the following:
// Assuming a many-many between role - user
$user->roles[] = $newRole;
This will load all roles of the user from the database if they're not yet loaded! Just to add one new link! Do this instead:
// Assuming a many-many between role - user, where UserRoleXref is the cross-reference table
$ref = new UserRoleXref();
$ref->role_id = $role_id;
$ref->user_id = $user_id;
$ref->save();