2006-07-24 01:08:06 +04:00
|
|
|
<?php
|
2006-08-22 02:51:27 +04:00
|
|
|
$table = $conn->getTable("User");
|
2006-07-24 01:08:06 +04:00
|
|
|
|
|
|
|
// find by primary key
|
2006-08-17 13:42:18 +04:00
|
|
|
|
|
|
|
$user = $table->find(2);
|
|
|
|
if($user !== false)
|
|
|
|
print $user->name;
|
2006-07-24 01:08:06 +04:00
|
|
|
|
|
|
|
// get all users
|
|
|
|
foreach($table->findAll() as $user) {
|
|
|
|
print $user->name;
|
|
|
|
}
|
|
|
|
|
2006-08-17 13:42:18 +04:00
|
|
|
// finding by dql
|
|
|
|
foreach($table->findByDql("name LIKE '%John%'") as $user) {
|
2006-07-24 01:08:06 +04:00
|
|
|
print $user->created;
|
|
|
|
}
|
|
|
|
|
|
|
|
// finding objects with DQL
|
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
$users = $conn->query("FROM User WHERE User.name LIKE '%John%'");
|
2006-07-24 01:08:06 +04:00
|
|
|
?>
|