DataMapper


Exists

Exists is a simple function that returns TRUE or FALSE depending on whether the object has a corresponding database record. For example:

$id = 42;

// Get user
$u = new User();
$u->get_by_id($id);

// Check if we actually got a user back from the database
if ($u->exists())
{
    // Yes, we did!
}
else
{
    // No, we didn't!
}