/** * Returns the EmergencyContact object with the given id from the database. * * @param int $id * @return EmergencyContact * @throws InvalidArgumentException * @throws Exception * @see EmergencyContactDB */ public static function getContactById($id) { if (is_null($id) || !isset($id)) { throw new \InvalidArgumentException('Missing contact id.'); } $db = new \PHPWS_DB('intern_emergency_contact'); $db->addWHere('id', $id); $contact = new EmergencyContactDB(); $result = $db->loadObject($contact); if (\PHPWS_Error::logIfError($result)) { throw new \Exception($result->toString()); } return $contact; }