2006-08-21 22:55:11 +00:00
|
|
|
You can retrieve existing objects (database rows) with Doctrine_Table or Doctrine_Connection.
|
2006-07-23 21:08:06 +00:00
|
|
|
Doctrine_Table provides simple methods like findBySql, findAll and find for finding objects whereas
|
2006-08-21 22:55:11 +00:00
|
|
|
Doctrine_Connection provides complete OQL API for retrieving objects (see chapter 9).
|
2007-04-12 20:52:30 +00:00
|
|
|
|
|
|
|
<code type="php">
|
|
|
|
$user = $table->find(3);
|
|
|
|
|
|
|
|
// access property through overloading
|
|
|
|
|
|
|
|
$name = $user->name;
|
|
|
|
|
|
|
|
// access property with get()
|
|
|
|
|
|
|
|
$name = $user->get("name");
|
|
|
|
|
|
|
|
// access property with ArrayAccess interface
|
|
|
|
|
|
|
|
$name = $user['name'];
|
|
|
|
|
|
|
|
// iterating through properties
|
|
|
|
|
|
|
|
foreach($user as $key => $value) {
|
|
|
|
|
|
|
|
}
|
|
|
|
</code>
|