Runtime classes - Doctrine_Record.php 627 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
Doctrine_Record is a wrapper for database row. 


<code type="php">
$user = $table->find(2);

// get state
$state = $user->getState();

print $user->name;

print $user["name"];

print $user->get("name");

$user->name = "Jack Daniels";

$user->set("name","Jack Daniels");

// serialize record

$serialized = serialize($user);

$user = unserialize($serialized);

// create a copy

$copy = $user->copy();

// get primary key

$id = $user->getID();

// print lots of useful info

print $user;

// save all the properties and composites
$user->save();

// delete this data access object and related objects
$user->delete();
</code>