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

24 lines
443 B
PHP

<?php
$table = $conn->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 = $conn->query("FROM User WHERE User.name LIKE '%John%'");
?>