1
0
mirror of synced 2024-12-14 23:26:04 +03:00
doctrine2/manual/codes/DQL (Doctrine Query Language) - Introduction.php

27 lines
629 B
PHP
Raw Normal View History

2006-09-29 15:17:16 +04:00
<?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 \>";
}
}
?>