Skip to content

Instantly share code, notes, and snippets.

@isaiahdw
Forked from anonymous/gist:247922
Created December 3, 2009 05:48
Show Gist options
  • Save isaiahdw/247923 to your computer and use it in GitHub Desktop.
Save isaiahdw/247923 to your computer and use it in GitHub Desktop.
class Contact_Model extends Model
{
public function read_contact($contact_id)
{
if(is_numeric($contact_id))
{
$query = ORM::factory('contact', $contact_id)->find();
}
else throw new Exception('Not a valid contact ID');
if($query->loaded)
{
return $query;
}
else throw new Exception('Contact not found.');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment