+++ MAP keyword
The MAP keyword offers a way of mapping certain columns as collection / array keys. By default Doctrine maps multiple elements to numerically indexed arrays / collections. The mapping starts from zero. In order to override this behaviour you need to use MAP keyword as shown above:
$q = new Doctrine_Query();
$q->from('User u MAP u.name');
$users = $q->execute();
Now the users in $users collection are accessible through their names.
print $user['jack daniels']->id;
The MAP keyword can be applied to any given JOIN. This means that any given component can have each own mapping behaviour. In the following we use distinct mappings for both Users and Groups.
$q = new Doctrine_Query();
$q->from('User u MAP u.name')->innerJoin('u.Group g MAP g.name');
$users = $q->execute();
Now lets print out the drinkers club's creation date.
print $users['jack daniels']->Group['drinkers club']->createdAt;