/** * Deletes the passed in EmergencyContact from the database. * @param EmergencyContact $contact * @throws InvalidArgumentException * @throws Exception */ public static function delete(EmergencyContact $contact) { $contactId = $contact->getId(); if (is_null($contactId) || !isset($contactId)) { throw new \InvalidArgumentException('Missing contact id.'); } $db = new \PHPWS_DB('intern_emergency_contact'); $db->addWhere('id', $contactId); $result = $db->delete(); if (\PHPWS_Error::logIfError($result)) { throw new \Exception($result->toString()); } return true; }