Working with objects - Component overview - Record - Updating records.php 452 Bytes
Newer Older
hansbrix's avatar
hansbrix committed
1 2 3
Updating objects is very easy, you just call the Doctrine_Record::save() method. The other way
(perhaps even easier) is to call Doctrine_Connection::flush() which saves all objects. It should be noted though
that flushing is a much heavier operation than just calling save method.
4

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


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

if($user !== false) {
    $user->name = "Jack Daniels";
    
    $user->save();
}
</code>