DataMapper


Clear

Clear is used to clear the object of data.

$id = 42;

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

// Show username
echo $u->username;

// Let's say it outputs "foo bar"

// Clear object
$u->clear();

// Try to show username again
echo $u->username;

// outputs nothing since the object has been cleared