/** * Deletes an existing Phone * * @param array $params * * @return array Api Result * {@getfields phone_delete} * @example PhoneDelete.php * @access public */ function civicrm_api3_phone_delete($params) { $phoneID = CRM_Utils_Array::value('id', $params); require_once 'CRM/Core/DAO/Phone.php'; $phoneDAO = new CRM_Core_DAO_Phone(); $phoneDAO->id = $phoneID; if ($phoneDAO->find()) { while ($phoneDAO->fetch()) { $phoneDAO->delete(); return civicrm_api3_create_success($phoneDAO->id, $params, $phoneDAO); } } else { return civicrm_api3_create_error('Could not delete phone with id ' . $phoneID); } }