if (empty($conf)) { die("No configuration found\n"); } /** */ class User extends Horde_Rdo_Base { } /** */ class UserMapper extends Horde_Rdo_Mapper { } $um = new UserMapper($conf['adapter']); // Count all users. $userCount = $um->count(); echo "# users: {$userCount}\n"; // Get the number of new users in May 2005 //$userCount = $um->count('created > \'2005-05-01\' AND created <= \'2005-05-31\''); //echo "# new: $userCount\n"; // Check if id 1 exists. $exists = $um->exists(1); echo "exists: " . ($exists ? 'yes' : 'no') . "\n"; // Look for Alice $userTwo = $um->findOne(array('name' => 'Alice')); if ($userTwo) { echo "Found Alice: id {$userTwo->id}\n"; } else { echo "No Alice found, creating:\n"; // $userOne = $um->create(array('name' => 'Alice', 'phone' => '212-555-6565')); $userOne = new User(array('name' => 'Alice', 'phone' => '212-555-6565'));