Getting the object back from the DB
Once the object is persisted to the database via a call to the object's save() method, you can now look up that instance in a number of ways.
By primary key
$person= $xpdo->getObject('Person', 1);
In this example, you are instantiating a persisted instance of the Person class which has a primary key with the value of 1.
By column values
I did add simple prepared statement abstraction to XPDO, so currently, to query objects by column values other than the primary key, you would use syntax like the following
$person= $xpdo->getObject('Person', array ('username' => 'boblabla');
By complex criteria
You can also construct platform optimized queries with complex business logic by creating an xPDOCriteria object representing a prepared statement.
$personTbl= $xpdo->getTableName('Person');
$criteria= new xPDOCriteria($xpdo, "SELECT p1.* FROM {$personTbl} p1 WHERE p1.username = :username AND EXISTS (SELECT 'x' FROM {$personTbl} p2 WHERE p2.id > 10 AND p2.id = p1.id)", array(':username' => 'boblabla'));
if ($person= $xpdo->getObject('Person', $criteria)) {
...
}