Basic Components - Table - Finder methods.php 347 Bytes
Newer Older
doctrine's avatar
doctrine committed
1
<?php
2
$table = $conn->getTable("User");
doctrine's avatar
doctrine committed
3 4

// find by primary key
5 6 7 8 9 10

$user = $table->find(2);

if($user !== false)
    print $user->name;

doctrine's avatar
doctrine committed
11 12 13 14 15 16

// get all users
foreach($table->findAll() as $user) {
    print $user->name;
}

17 18
// finding by dql
foreach($table->findByDql("name LIKE '%John%'") as $user) {
doctrine's avatar
doctrine committed
19 20 21
    print $user->created;
}
?>