1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/manual/codes/Basic Components - Record - Retrieving existing records.php

24 lines
449 B
PHP

<?php
$table = $session->getTable("User");
// find by primary key
$user = $table->find(2);
if($user !== false)
print $user->name;
// get all users
foreach($table->findAll() as $user) {
print $user->name;
}
// finding by dql
foreach($table->findByDql("name LIKE '%John%'") as $user) {
print $user->created;
}
// finding objects with DQL
$users = $session->query("FROM User WHERE User.name LIKE '%John%'");
?>