2006-07-27 22:25:18 +04:00
|
|
|
<?php
|
2006-08-22 02:51:27 +04:00
|
|
|
$users = $conn->query("FROM User");
|
2006-07-27 22:25:18 +04:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
?>
|