1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/manual/docs/Working with objects - Component overview - Record - Accessing properties.php

26 lines
624 B
PHP
Raw Normal View History

2006-08-22 02:55:11 +04:00
You can retrieve existing objects (database rows) with Doctrine_Table or Doctrine_Connection.
2006-07-24 01:08:06 +04:00
Doctrine_Table provides simple methods like findBySql, findAll and find for finding objects whereas
2006-08-22 02:55:11 +04:00
Doctrine_Connection provides complete OQL API for retrieving objects (see chapter 9).
<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>