Working with objects - Component overview - Collection - Accessing elements.php 382 Bytes
Newer Older
hansbrix's avatar
hansbrix committed
1
You can access the elements of Doctrine_Collection with set() and get() methods or with ArrayAccess interface.
2

hansbrix's avatar
hansbrix committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<code type="php">
$table = $conn->getTable("User");

$users = $table->findAll();

// accessing elements with ArrayAccess interface

$users[0]->name = "Jack Daniels";

$users[1]->name = "John Locke";

// accessing elements with get()

print $users->get(1)->name;
</code>