In Doctrine 1.2, it is possible to set up Key Mapping for a table where Doctrine_Collection
objects created by that table will populate keys from a particular column in each record in the collection.
An example from the documentation linked above:
You may want to map the name column:
// test.php // ... $userTable = Doctrine_Core::getTable('User'); $userTable->setAttribute(Doctrine_Core::ATTR_COLL_KEY, 'username');
Now user collections will use the values of name column as element indexes:
// test.php // ... $users = $userTable->findAll(); foreach($users as $username => $user) { echo $username . ' - ' . $user->created_at . "\n"; }
Is there a way to set this up in a schema.yml file?