1
0
mirror of synced 2025-01-18 06:21:40 +03:00
This commit is contained in:
doctrine 2006-07-27 18:25:18 +00:00
parent c4cba69935
commit ffe169cd03
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,20 @@
<?php
$users = $session->query("FROM User");
// now lets load phonenumbers for all users
$users->loadRelated("Phonenumber");
foreach($users as $user) {
print $user->Phonenumber->phonenumber;
// no additional db queries needed here
}
// the loadRelated works an any relation, even associations:
$users->loadRelated("Group");
foreach($users as $user) {
print $user->Group->name;
}
?>

View File

@ -0,0 +1,3 @@
Doctrine provides means for effiently retrieving all related records for all record elements. That means
when you have for example a collection of users you can load all phonenumbers for all users by simple calling
the loadRelated() method.