1
0
mirror of synced 2024-12-14 07:06:04 +03:00
doctrine2/manual/codes/DQL (Doctrine Query Language) - Introduction.php
2006-09-29 11:17:16 +00:00

27 lines
629 B
PHP

<?php
// DO NOT USE THE FOLLOWING CODE
// (using many sql queries for object population):
$users = $conn->getTable('User')->findAll();
foreach($users as $user) {
print $user->name."<br \>";
foreach($user->Phonenumber as $phonenumber) {
print $phonenumber."<br \>";
}
}
// same thing implemented much more efficiently:
// (using only one sql query for object population)
$users = $conn->query("FROM User.Phonenumber");
foreach($users as $user) {
print $user->name."<br \>";
foreach($user->Phonenumber as $phonenumber) {
print $phonenumber."<br \>";
}
}
?>