From: Coleman Watts Date: Fri, 20 Feb 2015 03:00:08 +0000 (-0500) Subject: CRM-15988 - Mass cleanup of api entity names to CamelCase X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=244bbdd85415317b95f70bf85a3ecb036c4fe840;p=civicrm-core.git CRM-15988 - Mass cleanup of api entity names to CamelCase --- diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 3976e62e01..5b3740658d 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -1517,6 +1517,8 @@ class CRM_Contact_BAO_Query { static $skipWhere = NULL; static $likeNames = NULL; $result = NULL; + // Change camelCase EntityName to lowercase with underscores + $apiEntity = _civicrm_api_get_entity_name_from_camel($apiEntity); if (CRM_Utils_System::isNull($values)) { return $result; diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index 458618cce6..aa30ae5024 100755 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -591,7 +591,7 @@ AND cas.entity_value = $id AND * @param array $params * (reference ) an assoc array of name/value pairs. * @param array $ids - * The array that holds all the db ids. + * Unused variable. * * @return CRM_Core_DAO_ActionSchedule */ @@ -947,7 +947,7 @@ WHERE reminder.action_schedule_id = %1 AND reminder.action_date_time IS NULL $actionSchedule->mapping_id = $mappingID; $actionSchedule->is_active = 1; if (!empty($params)) { - _civicrm_api3_dao_set_filter($actionSchedule, $params, FALSE, 'ActionSchedule'); + _civicrm_api3_dao_set_filter($actionSchedule, $params, FALSE); } $actionSchedule->find(); diff --git a/api/v3/Acl.php b/api/v3/Acl.php index f8d1df5e28..6a63178ac0 100644 --- a/api/v3/Acl.php +++ b/api/v3/Acl.php @@ -26,37 +26,36 @@ */ /** - * This api exposes CiviCRM acl. + * This api exposes CiviCRM Acl records. * * @package CiviCRM_APIv3 */ /** - * Save an acl. + * Save an Acl. * * @param array $params * * @return array - * Array of newly created acl property values. */ function civicrm_api3_acl_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** - * Get an acl. + * Get an Acl. * * @param array $params * * @return array - * Array of retrieved acl property values. + * Array of retrieved Acl property values. */ function civicrm_api3_acl_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** - * Delete an acl. + * Delete an Acl. * * @param array $params * diff --git a/api/v3/AclRole.php b/api/v3/AclRole.php index d4f5c95ae1..ea9b4a28a4 100644 --- a/api/v3/AclRole.php +++ b/api/v3/AclRole.php @@ -26,39 +26,38 @@ */ /** - * This api exposes CiviCRM acl_role. + * This api exposes CiviCRM AclRole. * * @package CiviCRM_APIv3 */ /** - * Save an acl_role. + * Save an AclRole. * * Allowed @params array keys are: * * @param array $params * * @return array - * Array of newly created acl_role property values. */ function civicrm_api3_acl_role_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** - * Get an acl_role. + * Get an AclRole. * * @param array $params * * @return array - * Array of retrieved acl_role property values. + * Array of retrieved AclRole property values. */ function civicrm_api3_acl_role_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** - * Delete an acl_role. + * Delete an AclRole. * * @param array $params * diff --git a/api/v3/ActionSchedule.php b/api/v3/ActionSchedule.php index 0a5083b87d..8486c51baf 100644 --- a/api/v3/ActionSchedule.php +++ b/api/v3/ActionSchedule.php @@ -32,19 +32,19 @@ */ /** - * Get CiviCRM Action Schedule details. + * Get CiviCRM ActionSchedule details. * * @param array $params * * @return array */ function civicrm_api3_action_schedule_get($params) { - return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'action_schedule'); + return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ActionSchedule'); } /** - * Create a new Action Schedule. + * Create a new ActionSchedule. * * @param array $params * @@ -55,7 +55,7 @@ function civicrm_api3_action_schedule_create($params) { if (!array_key_exists('name', $params) && !array_key_exists('id', $params)) { $params['name'] = CRM_Utils_String::munge($params['title']); } - return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'action_schedule'); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ActionSchedule'); } /** @@ -73,7 +73,7 @@ function _civicrm_api3_action_schedule_create_spec(&$params) { } /** - * Delete an existing action_schedule. + * Delete an existing ActionSchedule. * * @param array $params * Array containing id of the action_schedule to be deleted. diff --git a/api/v3/Activity.php b/api/v3/Activity.php index d3b43a2e28..48cc185572 100644 --- a/api/v3/Activity.php +++ b/api/v3/Activity.php @@ -26,7 +26,7 @@ */ /** - * This api exposes CiviCRM activity. + * This api exposes CiviCRM Activity records. * * @package CiviCRM_APIv3 */ @@ -165,7 +165,7 @@ function civicrm_api3_activity_create($params) { } _civicrm_api3_object_to_array($activityBAO, $activityArray[$activityBAO->id]); - return civicrm_api3_create_success($activityArray, $params, 'activity', 'get', $activityBAO); + return civicrm_api3_create_success($activityArray, $params, 'Activity', 'get', $activityBAO); } } @@ -228,14 +228,14 @@ function civicrm_api3_activity_get($params) { else { $activities = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE); } - $options = _civicrm_api3_get_options_from_params($params, FALSE, 'activity', 'get'); + $options = _civicrm_api3_get_options_from_params($params, FALSE, 'Activity', 'get'); if ($options['is_count']) { - return civicrm_api3_create_success($activities, $params, 'activity', 'get'); + return civicrm_api3_create_success($activities, $params, 'Activity', 'get'); } $activities = _civicrm_api3_activity_get_formatResult($params, $activities); //legacy custom data get - so previous formatted response is still returned too - return civicrm_api3_create_success($activities, $params, 'activity', 'get'); + return civicrm_api3_create_success($activities, $params, 'Activity', 'get'); } /** @@ -314,10 +314,10 @@ function _civicrm_api3_activity_get_formatResult($params, $activities) { function civicrm_api3_activity_delete($params) { if (CRM_Activity_BAO_Activity::deleteActivity($params)) { - return civicrm_api3_create_success(1, $params, 'activity', 'delete'); + return civicrm_api3_create_success(1, $params, 'Activity', 'delete'); } else { - throw new API_Exception('Could not delete activity'); + throw new API_Exception('Could not delete Activity'); } } diff --git a/api/v3/ActivityContact.php b/api/v3/ActivityContact.php index c030330935..c807420d8b 100644 --- a/api/v3/ActivityContact.php +++ b/api/v3/ActivityContact.php @@ -26,7 +26,7 @@ */ /** - * This api exposes CiviCRM activity contact. + * This api exposes the CiviCRM ActivityContact join table. * * @package CiviCRM_APIv3 */ diff --git a/api/v3/ActivityType.php b/api/v3/ActivityType.php index ebcc8b040c..30c8a85a46 100644 --- a/api/v3/ActivityType.php +++ b/api/v3/ActivityType.php @@ -26,7 +26,7 @@ */ /** - * The activity_type api is deprecated. Please use the option_value api instead. + * The ActivityType api is deprecated. Please use the OptionValue api instead. * * @deprecated * @@ -41,7 +41,7 @@ * to indicate this entire api entity is deprecated */ function _civicrm_api3_activity_type_deprecation() { - return 'The activity_type api is deprecated. Please use the option_value api instead.'; + return 'The ActivityType api is deprecated. Please use the OptionValue api instead.'; } /** @@ -51,7 +51,7 @@ function _civicrm_api3_activity_type_deprecation() { * * @return array * activity types keyed by id - * @deprecated - use getoptions + * @deprecated - use the getoptions action instead */ function civicrm_api3_activity_type_get($params) { @@ -67,7 +67,7 @@ function civicrm_api3_activity_type_get($params) { * @return array * created / updated activity type * - * @deprecated use option_value api + * @deprecated use the OptionValue api instead */ function civicrm_api3_activity_type_create($params) { @@ -100,7 +100,7 @@ function _civicrm_api3_activity_type_create_spec(&$params) { } /** - * Delete activity type. + * Delete ActivityType. * * @param array $params * Array including id of activity_type to delete. @@ -108,7 +108,7 @@ function _civicrm_api3_activity_type_create_spec(&$params) { * @return array * API result array * - * @deprecated use option_value api + * @deprecated use OptionValue api */ function civicrm_api3_activity_type_delete($params) { return civicrm_api3_create_success(CRM_Core_BAO_OptionValue::del($params['id']), $params); diff --git a/api/v3/Address.php b/api/v3/Address.php index b3f644b256..40da8a40ae 100644 --- a/api/v3/Address.php +++ b/api/v3/Address.php @@ -26,7 +26,7 @@ */ /** - * This api exposes CiviCRM address records. + * This api exposes CiviCRM Address records. * * @package CiviCRM_APIv3 */ @@ -38,7 +38,6 @@ * Array per getfields metadata. * * @return array - * Array of newly created tag property values. */ function civicrm_api3_address_create(&$params) { /** @@ -79,7 +78,7 @@ function civicrm_api3_address_create(&$params) { } else { $values = _civicrm_api3_dao_to_array($addressBAO, $params); - return civicrm_api3_create_success($values, $params, 'address', $addressBAO); + return civicrm_api3_create_success($values, $params, 'Address', $addressBAO); } } diff --git a/api/v3/Attachment.php b/api/v3/Attachment.php index 5bc789282b..5ca4f68c39 100644 --- a/api/v3/Attachment.php +++ b/api/v3/Attachment.php @@ -96,12 +96,11 @@ function _civicrm_api3_attachment_create_spec(&$spec) { } /** - * Create an attachment. + * Create an Attachment. * * @param array $params * * @return array - * Array of newly created file property values. * @throws API_Exception validation errors * @see Civi\API\Subscriber\DynamicFKAuthorization */ @@ -189,7 +188,7 @@ function _civicrm_api3_attachment_get_spec(&$spec) { } /** - * Get attachment. + * Get Attachment. * * @param array $params * @@ -209,7 +208,7 @@ function civicrm_api3_attachment_get($params) { } /** - * Adjust metadata for attachment delete action. + * Adjust metadata for Attachment delete action. * * @param $spec */ @@ -223,7 +222,7 @@ function _civicrm_api3_attachment_delete_spec(&$spec) { } /** - * Delete attachment. + * Delete Attachment. * * @param array $params * diff --git a/api/v3/Batch.php b/api/v3/Batch.php index eb46526c7b..32bb97b5a2 100644 --- a/api/v3/Batch.php +++ b/api/v3/Batch.php @@ -26,7 +26,7 @@ */ /** - * This api exposes CiviCRM batch. + * This api exposes CiviCRM Batch records. * * @package CiviCRM_APIv3 */ @@ -37,7 +37,6 @@ * @param array $params * * @return array - * Array of newly created batch property values. */ function civicrm_api3_batch_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); diff --git a/api/v3/Campaign.php b/api/v3/Campaign.php index 836f542774..3f56d470bb 100644 --- a/api/v3/Campaign.php +++ b/api/v3/Campaign.php @@ -26,7 +26,7 @@ */ /** - * This api exposes CiviCRM campaign records. + * This api exposes CiviCRM Campaign records. * * @note Campaign component must be enabled. * @@ -34,7 +34,7 @@ */ /** - * Create/update campaign. + * Create/update Campaign. * * This API is used to create new campaign or update any of the existing * In case of updating existing campaign, id of that particular campaign must @@ -61,7 +61,7 @@ function _civicrm_api3_campaign_create_spec(&$params) { } /** - * Returns array of campaigns matching a set of one or more group properties. + * Returns array of campaigns matching a set of one or more properties. * * @param array $params * Array per getfields @@ -76,8 +76,8 @@ function civicrm_api3_campaign_get($params) { /** * Delete an existing campaign. * - * This method is used to delete any existing campaign. id of the group - * to be deleted is required field in $params array + * This method is used to delete any existing campaign. + * Id of the campaign to be deleted is required field in $params array * * @param array $params * array containing id of the group to be deleted diff --git a/api/v3/Case.php b/api/v3/Case.php index 79dd0b6bfc..a7fe9c4d52 100644 --- a/api/v3/Case.php +++ b/api/v3/Case.php @@ -34,7 +34,7 @@ /** - * Open a new case, add client and manager roles, and add standard timeline. + * Open a new case, add client and manager roles, and standard timeline. * * @param array $params * @code @@ -124,7 +124,7 @@ function civicrm_api3_case_create($params) { $values = array(); _civicrm_api3_object_to_array($caseBAO, $values[$caseBAO->id]); - return civicrm_api3_create_success($values, $params, 'case', 'create', $caseBAO); + return civicrm_api3_create_success($values, $params, 'Case', 'create', $caseBAO); } /** @@ -213,7 +213,7 @@ function civicrm_api3_case_get($params) { $cases[$id] = $case; } } - return civicrm_api3_create_success($cases, $params, 'case', 'get'); + return civicrm_api3_create_success($cases, $params, 'Case', 'get'); } //search by activity @@ -223,10 +223,10 @@ function civicrm_api3_case_get($params) { } $caseId = CRM_Case_BAO_Case::getCaseIdByActivityId($params['activity_id']); if (!$caseId) { - return civicrm_api3_create_success(array(), $params, 'case', 'get'); + return civicrm_api3_create_success(array(), $params, 'Case', 'get'); } $case = array($caseId => _civicrm_api3_case_read($caseId, $options)); - return civicrm_api3_create_success($case, $params, 'case', 'get'); + return civicrm_api3_create_success($case, $params, 'Case', 'get'); } //search by contacts @@ -247,7 +247,7 @@ SELECT DISTINCT case_id while ($dao->fetch()) { $cases[$dao->case_id] = _civicrm_api3_case_read($dao->case_id, $options); } - return civicrm_api3_create_success($cases, $params, 'case', 'get'); + return civicrm_api3_create_success($cases, $params, 'Case', 'get'); } // For historic reasons we always return these when an id is provided @@ -264,7 +264,7 @@ SELECT DISTINCT case_id } } - return civicrm_api3_create_success($cases, $params, 'case', 'get'); + return civicrm_api3_create_success($cases, $params, 'Case', 'get'); } /** @@ -359,18 +359,20 @@ function civicrm_api3_case_update($params) { _civicrm_api3_object_to_array($dao, $case); $values[$dao->id] = $case; - return civicrm_api3_create_success($values, $params, 'case', 'update', $dao); + return civicrm_api3_create_success($values, $params, 'Case', 'update', $dao); } /** * Delete a specified case. * * @param array $params + * @code * //REQUIRED: * 'id' => int * * //OPTIONAL * 'move_to_trash' => bool (defaults to false) + * @endcode * * @throws API_Exception * @return bool @@ -381,7 +383,7 @@ function civicrm_api3_case_delete($params) { civicrm_api3_verify_mandatory($params, NULL, array('id')); if (CRM_Case_BAO_Case::deleteCase($params['id'], CRM_Utils_Array::value('move_to_trash', $params, FALSE))) { - return civicrm_api3_create_success($params, $params, 'case', 'delete'); + return civicrm_api3_create_success($params, $params, 'Case', 'delete'); } else { throw new API_Exception('Could not delete case.'); diff --git a/api/v3/CaseType.php b/api/v3/CaseType.php index bd556ec65a..b159dad5c2 100644 --- a/api/v3/CaseType.php +++ b/api/v3/CaseType.php @@ -106,7 +106,7 @@ function _civicrm_api3_case_type_get_formatResult(&$result) { * Function to delete case type. * * @param array $params - * Array including id of case_type to delete. + * Array including id of CaseType to delete. * * @return array * API result array diff --git a/api/v3/Constant.php b/api/v3/Constant.php index cdcf39eb5f..a11ac1195a 100644 --- a/api/v3/Constant.php +++ b/api/v3/Constant.php @@ -29,7 +29,7 @@ * CiviCRM APIv3 pseudoconstants * * @deprecated - * The constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead. + * The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead. * @package CiviCRM_APIv3 */ @@ -41,7 +41,7 @@ * to indicate this entire api entity is deprecated */ function _civicrm_api3_constant_deprecation() { - return 'The constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.'; + return 'The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.'; } /** @@ -53,48 +53,46 @@ function _civicrm_api3_constant_deprecation() { * @param array $params * Name of a public static method of * CRM_Core_PseudoConstant: one of - * + * activityStatus + * activityType + * addressee + * allGroup + * country + * countryIsoCode + * county + * currencyCode + * currencySymbols + * customGroup + * emailGreeting + * fromEmailAddress + * gender + * group + * groupIterator + * honor + * IMProvider + * individualPrefix + * individualSuffix + * locationType + * locationVcardName + * mailProtocol + * mappingTypes + * paymentProcessor + * paymentProcessorType + * pcm + * phoneType + * postalGreeting + * priority + * relationshipType + * stateProvince + * stateProvinceAbbreviation + * stateProvinceForCountry + * staticGroup + * tag + * tasks + * ufGroup + * visibility + * worldRegion + * wysiwygEditor * * @return array */ @@ -126,12 +124,12 @@ function civicrm_api3_constant_get($params) { //@TODO XAV take out the param the COOKIE, Entity, Action and so there are only the "real param" in it //$values = call_user_func_array( array( $className, $name ), $params ); } - return civicrm_api3_create_success($values, $params, 'constant'); + return civicrm_api3_create_success($values, $params, 'Constant'); } else { $values = call_user_func(array('CRM_Utils_PseudoConstant', 'getConstant'), $name); if (!empty($values)) { - return civicrm_api3_create_success($values, $params, 'constant'); + return civicrm_api3_create_success($values, $params, 'Constant'); } } return civicrm_api3_create_error('Unknown civicrm constant or method not callable'); diff --git a/api/v3/Contact.php b/api/v3/Contact.php index 99fca5a0b0..c9dc42d61a 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -27,6 +27,7 @@ /** * This api exposes CiviCRM contacts. + * * Contacts are the main entity in CiviCRM and this api is more robust than most. * - Get action allows all params supported by advanced search. * - Create action allows creating several related entities at once (e.g. email). @@ -37,7 +38,7 @@ */ /** - * Create or update a contact. + * Create or update a Contact. * * @param array $params * Input parameters. @@ -142,12 +143,12 @@ function _civicrm_api3_contact_create_spec(&$params) { function civicrm_api3_contact_get($params) { $options = array(); _civicrm_api3_contact_get_supportanomalies($params, $options); - $contacts = _civicrm_api3_get_using_query_object('contact', $params, $options); - return civicrm_api3_create_success($contacts, $params, 'contact'); + $contacts = _civicrm_api3_get_using_query_object('Contact', $params, $options); + return civicrm_api3_create_success($contacts, $params, 'Contact'); } /** - * Get count of contact. + * Get number of contacts matching the supplied criteria. * * @param array $params * @@ -156,7 +157,7 @@ function civicrm_api3_contact_get($params) { function civicrm_api3_contact_getcount($params) { $options = array(); _civicrm_api3_contact_get_supportanomalies($params, $options); - $count = _civicrm_api3_get_using_query_object('contact', $params, $options, 1); + $count = _civicrm_api3_get_using_query_object('Contact', $params, $options, 1); return (int) $count; } @@ -211,7 +212,7 @@ function _civicrm_api3_contact_get_spec(&$params) { /** * Support for historical oddities. * - * We are supporting 'showAll' = 'all', 'trash' or 'active' for contact get + * We are supporting 'showAll' = 'all', 'trash' or 'active' for Contact get * and for getcount * - hopefully some day we'll come up with a std syntax for the 3-way-boolean of * 0, 1 or not set @@ -256,7 +257,7 @@ function _civicrm_api3_contact_get_supportanomalies(&$params, &$options) { } /** - * Delete a contact with given contact id. + * Delete a Contact with given contact_id. * * @param array $params * input parameters per getfields @@ -379,7 +380,7 @@ function _civicrm_api3_contact_check_params(&$params, $dupeCheck) { $params['employer_id'] = $dupeIds[0]; } else { - $result = civicrm_api3('contact', 'create', array( + $result = civicrm_api3('Contact', 'create', array( 'organization_name' => $params['current_employer'], 'contact_type' => 'Organization', )); @@ -391,7 +392,7 @@ function _civicrm_api3_contact_check_params(&$params, $dupeCheck) { } /** - * Helper function for contact create. + * Helper function for Contact create. * * @param array $params * (reference ) an assoc array of name/value pairs. @@ -535,7 +536,7 @@ function _civicrm_api3_greeting_format_params($params) { } /** - * Old contact quick search api. + * Old Contact quick search api. * * @deprecated * @@ -686,7 +687,7 @@ function civicrm_api3_contact_getquick($params) { $where .= " AND cc.contact_type LIKE '{$contactType}'"; } - //set default for current_employer or return contact with particular id + // Set default for current_employer or return contact with particular id if (!empty($params['id'])) { $where .= " AND cc.id = " . (int) $params['id']; } @@ -695,7 +696,7 @@ function civicrm_api3_contact_getquick($params) { $where .= " AND cc.id <> " . (int) $params['cid']; } - //contact's based of relationhip type + // Contact's based of relationhip type $relType = NULL; if (!empty($params['rel'])) { $relation = explode('_', CRM_Utils_Array::value('rel', $params)); @@ -833,7 +834,7 @@ LIMIT 0, {$limit} } } - return civicrm_api3_create_success($contactList, $params, 'contact', 'getquick'); + return civicrm_api3_create_success($contactList, $params, 'Contact', 'getquick'); } /** @@ -941,7 +942,7 @@ WHERE $whereClause $contacts[] = $dao->toArray(); } - return civicrm_api3_create_success($contacts, $params, 'contact', 'get_by_location', $dao); + return civicrm_api3_create_success($contacts, $params, 'Contact', 'get_by_location', $dao); } diff --git a/api/v3/ContactType.php b/api/v3/ContactType.php index 6e4567493b..2d77860bec 100644 --- a/api/v3/ContactType.php +++ b/api/v3/ContactType.php @@ -36,17 +36,17 @@ */ /** - * Create/update contact_type. + * Create/update ContactType. * - * This API is used to create new contact_type or update any of the existing - * In case of updating existing contact_type, id of that particular contact_type must + * This API is used to create new ContactType or update any of the existing + * In case of updating existing ContactType, id of that particular ContactType must * be in $params array. * * @param array $params * Array per getfields metadata. * * @return array - * contact_type array + * ContactType array */ function civicrm_api3_contact_type_create($params) { civicrm_api3_verify_mandatory($params, _civicrm_api3_get_DAO(__FUNCTION__), array('name', 'parent_id')); @@ -80,10 +80,9 @@ function civicrm_api3_contact_type_get($params) { } /** - * Delete an existing contact_type. + * Delete an existing ContactType. * - * This method is used to delete any existing contact_type. id of the group - * to be deleted is required field in $params array + * This method is used to delete any existing ContactType given its id. * * @param array $params * [id] diff --git a/api/v3/Contribution.php b/api/v3/Contribution.php index 1a2dff8fd4..3b99d9690f 100644 --- a/api/v3/Contribution.php +++ b/api/v3/Contribution.php @@ -32,7 +32,7 @@ */ /** - * Add or update a contribution. + * Add or update a Contribution. * * @param array $params * Input parameters. @@ -166,7 +166,7 @@ function _civicrm_api3_contribution_create_legacy_support_45(&$params) { } /** - * Delete a contribution. + * Delete a Contribution. * * @param array $params * Input parameters. @@ -207,8 +207,7 @@ function _civicrm_api3_contribution_delete_spec(&$params) { function civicrm_api3_contribution_get($params) { $mode = CRM_Contact_BAO_Query::MODE_CONTRIBUTE; - $entity = 'contribution'; - list($dao, $query) = _civicrm_api3_get_query_object($params, $mode, $entity); + list($dao, $query) = _civicrm_api3_get_query_object($params, $mode, 'Contribution'); $contribution = array(); while ($dao->fetch()) { @@ -219,7 +218,7 @@ function civicrm_api3_contribution_get($params) { // format soft credit for backward compatibility _civicrm_api3_format_soft_credit($contribution[$dao->contribution_id]); } - return civicrm_api3_create_success($contribution, $params, 'contribution', 'get', $dao); + return civicrm_api3_create_success($contribution, $params, 'Contribution', 'get', $dao); } /** @@ -282,7 +281,7 @@ function _civicrm_api3_contribute_format_params($params, &$values) { * Array of parameters determined by getfields. */ function _civicrm_api3_contribution_transact_spec(&$params) { - $fields = civicrm_api3('contribution', 'getfields', array('action' => 'create')); + $fields = civicrm_api3('Contribution', 'getfields', array('action' => 'create')); $params = array_merge($params, $fields['values']); $params['receive_date']['api.default'] = 'now'; } @@ -327,7 +326,7 @@ function civicrm_api3_contribution_transact($params) { $transaction = $payment->doPayment($params); $params['payment_instrument_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessorType', $paymentProcessor['payment_processor_type_id'], 'payment_type') == 1 ? 'Credit Card' : 'Debit Card'; - return civicrm_api('contribution', 'create', $params); + return civicrm_api('Contribution', 'create', $params); } /** diff --git a/api/v3/ContributionPage.php b/api/v3/ContributionPage.php index ddf9b344fb..27d4605610 100644 --- a/api/v3/ContributionPage.php +++ b/api/v3/ContributionPage.php @@ -33,7 +33,7 @@ */ /** - * Create or update a contribution_page. + * Create or update a ContributionPage. * * @param array $params * Array per getfields metadata. @@ -63,7 +63,7 @@ function _civicrm_api3_contribution_page_create_spec(&$params) { } /** - * Returns array of contribution_pages matching a set of one or more group properties. + * Returns array of ContributionPage(s) matching a set of one or more group properties. * * @param array $params * Array per getfields metadata. @@ -76,10 +76,9 @@ function civicrm_api3_contribution_page_get($params) { } /** - * Delete an existing contribution_page. + * Delete an existing ContributionPage. * - * This method is used to delete any existing contribution_page. id of the group - * to be deleted is required field in $params array + * This method is used to delete any existing ContributionPage given its id. * * @param array $params * Array per getfields metadata. @@ -92,7 +91,7 @@ function civicrm_api3_contribution_page_delete($params) { } /** - * Submit a contribution_page. + * Submit a ContributionPage. * * @param array $params * Array per getfields metadata. @@ -102,5 +101,5 @@ function civicrm_api3_contribution_page_delete($params) { */ function civicrm_api3_contribution_page_submit($params) { $result = CRM_Contribute_Form_Contribution_Confirm::submit($params); - return civicrm_api3_create_success($result, $params, 'contribution_page', 'submit'); + return civicrm_api3_create_success($result, $params, 'ContributionPage', 'submit'); } diff --git a/api/v3/ContributionRecur.php b/api/v3/ContributionRecur.php index 0133aba973..4ae98e3b1c 100644 --- a/api/v3/ContributionRecur.php +++ b/api/v3/ContributionRecur.php @@ -32,7 +32,7 @@ */ /** - * Create or update a contribution_recur. + * Create or update a ContributionRecur. * * @param array $params * Array per getfields metadata. @@ -73,7 +73,7 @@ function civicrm_api3_contribution_recur_get($params) { } /** - * Cancel a recurring contribution of existing contribution_recur.id. + * Cancel a recurring contribution of existing ContributionRecur given its id. * * @param array $params * Array containing id of the recurring contribution. @@ -87,10 +87,9 @@ function civicrm_api3_contribution_recur_cancel($params) { } /** - * Delete an existing contribution_recur. + * Delete an existing ContributionRecur. * - * This method is used to delete any existing contribution_recur. id of the group - * to be deleted is required field in $params array + * This method is used to delete an existing ContributionRecur given its id. * * @param array $params * [id] diff --git a/api/v3/ContributionSoft.php b/api/v3/ContributionSoft.php index e678a49887..e1924ffdb3 100644 --- a/api/v3/ContributionSoft.php +++ b/api/v3/ContributionSoft.php @@ -26,7 +26,7 @@ */ /** - * This api exposes CiviCRM soft credit. + * This api exposes CiviCRM soft credits. * * @package CiviCRM_APIv3 */ diff --git a/api/v3/CustomField.php b/api/v3/CustomField.php index e9e05d5001..f18237e477 100644 --- a/api/v3/CustomField.php +++ b/api/v3/CustomField.php @@ -59,14 +59,14 @@ function civicrm_api3_custom_field_create($params) { $customField = CRM_Core_BAO_CustomField::create($params); _civicrm_api3_object_to_array_unique_fields($customField, $values[$customField->id]); _civicrm_api3_custom_field_flush_static_caches(); - return civicrm_api3_create_success($values, $params, 'custom_field', $customField); + return civicrm_api3_create_success($values, $params, 'CustomField', $customField); } /** * Flush static caches in functions that might have stored available custom fields. */ function _civicrm_api3_custom_field_flush_static_caches() { - civicrm_api('custom_field', 'getfields', array('version' => 3, 'cache_clear' => 1)); + civicrm_api('CustomField', 'getfields', array('version' => 3, 'cache_clear' => 1)); CRM_Core_BAO_UFField::getAvailableFieldsFlat(TRUE); } @@ -102,7 +102,7 @@ function civicrm_api3_custom_field_delete($params) { $field->id = $params['id']; $field->find(TRUE); $customFieldDelete = CRM_Core_BAO_CustomField::deleteField($field); - civicrm_api('custom_field', 'getfields', array('version' => 3, 'cache_clear' => 1)); + civicrm_api('CustomField', 'getfields', array('version' => 3, 'cache_clear' => 1)); return $customFieldDelete ? civicrm_api3_create_error('Error while deleting custom field') : civicrm_api3_create_success(); } diff --git a/api/v3/CustomSearch.php b/api/v3/CustomSearch.php index 1862a6329d..f10197b43d 100644 --- a/api/v3/CustomSearch.php +++ b/api/v3/CustomSearch.php @@ -55,7 +55,6 @@ function civicrm_api3_custom_search_get($params) { * @param array $params * * @return array - * Array of newly created option_value property values. */ function civicrm_api3_custom_search_create($params) { require_once 'api/v3/OptionValue.php'; diff --git a/api/v3/CustomValue.php b/api/v3/CustomValue.php index f7ef22ff9a..d3b67a3533 100644 --- a/api/v3/CustomValue.php +++ b/api/v3/CustomValue.php @@ -102,7 +102,7 @@ function civicrm_api3_custom_value_create($params) { if ($result['is_error']) { throw new Exception($result['error_message']); } - return civicrm_api3_create_success(TRUE, $params); + return civicrm_api3_create_success(TRUE, $params, 'CustomValue'); } /** @@ -169,7 +169,7 @@ function civicrm_api3_custom_value_get($params) { if ($result['is_error']) { if ($result['error_message'] == "No values found for the specified entity ID and custom field(s).") { $values = array(); - return civicrm_api3_create_success($values, $params); + return civicrm_api3_create_success($values, $params, 'CustomValue'); } else { throw new API_Exception($result['error_message']); @@ -217,7 +217,7 @@ function civicrm_api3_custom_value_get($params) { $values[$id]['id'] = $id; $values[$id][$n] = $value; } - return civicrm_api3_create_success($values, $params); + return civicrm_api3_create_success($values, $params, 'CustomValue'); } } diff --git a/api/v3/Dashboard.php b/api/v3/Dashboard.php index 88d0875d37..455ebbd22c 100644 --- a/api/v3/Dashboard.php +++ b/api/v3/Dashboard.php @@ -73,9 +73,9 @@ function _civicrm_api3_dashboard_create_spec(&$params) { */ function civicrm_api3_dashboard_get($params) { $bao = new CRM_Core_BAO_Dashboard(); - _civicrm_api3_dao_set_filter($bao, $params, TRUE, 'Dashboard'); + _civicrm_api3_dao_set_filter($bao, $params, TRUE); $dashlets = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'Dashboard'); - return civicrm_api3_create_success($dashlets, $params, 'dashboard', 'get', $bao); + return civicrm_api3_create_success($dashlets, $params, 'Dashboard', 'get', $bao); } /** @@ -88,7 +88,7 @@ function civicrm_api3_dashboard_get($params) { */ function civicrm_api3_dashboard_delete($params) { if (CRM_Core_BAO_Dashboard::deleteDashlet($params['id'])) { - return civicrm_api3_create_success(1, $params, 'dashboard', 'delete'); + return civicrm_api3_create_success(1, $params, 'Dashboard', 'delete'); } else { return civicrm_api3_create_error('Could not delete dashlet'); diff --git a/api/v3/Domain.php b/api/v3/Domain.php index baa367524a..fcfa963815 100644 --- a/api/v3/Domain.php +++ b/api/v3/Domain.php @@ -26,13 +26,13 @@ */ /** - * This api exposes CiviCRM domain. + * This api exposes CiviCRM Domain configuration settings. * * @package CiviCRM_APIv3 */ /** - * Get CiviCRM domain details. + * Get CiviCRM Domain details. * * @param array $params * @@ -53,8 +53,8 @@ function civicrm_api3_domain_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } - _civicrm_api3_dao_set_filter($bao, $params, TRUE, 'domain'); - $domains = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'domain'); + _civicrm_api3_dao_set_filter($bao, $params, TRUE); + $domains = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'Domain'); foreach ($domains as $domain) { if (!empty($domain['contact_id'])) { @@ -105,7 +105,7 @@ function civicrm_api3_domain_get($params) { } } - return civicrm_api3_create_success($domains, $params, 'domain', 'get', $bao); + return civicrm_api3_create_success($domains, $params, 'Domain', 'get', $bao); } /** @@ -121,7 +121,7 @@ function _civicrm_api3_domain_get_spec(&$params) { } /** - * Create a new domain. + * Create a new Domain. * * @param array $params * diff --git a/api/v3/Email.php b/api/v3/Email.php index 3f03ffb265..ca603647ad 100644 --- a/api/v3/Email.php +++ b/api/v3/Email.php @@ -26,7 +26,7 @@ */ /** - * This api exposes CiviCRM email. + * This api exposes CiviCRM email records. * * @package CiviCRM_APIv3 */ @@ -82,6 +82,5 @@ function civicrm_api3_email_delete($params) { * api result array */ function civicrm_api3_email_get($params) { - return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } diff --git a/api/v3/Entity.php b/api/v3/Entity.php index 03453eb835..5113466851 100644 --- a/api/v3/Entity.php +++ b/api/v3/Entity.php @@ -3,6 +3,8 @@ /** * Get list of deprecated entities. * + * This is called by the api wrapper when returning the result of api.Entity.get. + * * @param array $entities * * @return array diff --git a/api/v3/EntityTag.php b/api/v3/EntityTag.php index d3f7f97ccf..e1d690fb9f 100644 --- a/api/v3/EntityTag.php +++ b/api/v3/EntityTag.php @@ -26,15 +26,14 @@ */ /** - * This api exposes CiviCRM entity tag. + * This api exposes CiviCRM EntityTag records. + * + * Use this api to add/remove tags from a contact/activity/etc. + * To create/update/delete the tags themselves, use the Tag api. * * @package CiviCRM_APIv3 */ -/** - * Include utility functions - */ - /** * Get entity tags. * @@ -54,7 +53,7 @@ function civicrm_api3_entity_tag_get($params) { foreach ($values as $v) { $result[$v] = array('tag_id' => $v); } - return civicrm_api3_create_success($result, $params); + return civicrm_api3_create_success($result, $params, 'EntityTag'); } } diff --git a/api/v3/Event.php b/api/v3/Event.php index df09a5767d..3050081a74 100644 --- a/api/v3/Event.php +++ b/api/v3/Event.php @@ -27,7 +27,7 @@ /** * - * This api exposes CiviCRM event. + * This api exposes CiviCRM Event. * * @package CiviCRM_APIv3 */ @@ -115,7 +115,7 @@ function civicrm_api3_event_get($params) { } $eventDAO = new CRM_Event_BAO_Event(); - _civicrm_api3_dao_set_filter($eventDAO, $params, TRUE, 'Event'); + _civicrm_api3_dao_set_filter($eventDAO, $params, TRUE); if (!empty($params['isCurrent'])) { $eventDAO->whereAdd('(start_date >= CURDATE() || end_date >= CURDATE())'); @@ -141,7 +141,7 @@ function civicrm_api3_event_get($params) { } } - return civicrm_api3_create_success($event, $params, 'event', 'get', $eventDAO); + return civicrm_api3_create_success($event, $params, 'Event', 'get', $eventDAO); } /** @@ -176,9 +176,9 @@ function _civicrm_api3_event_get_legacy_support_42(&$event, $event_id) { } /** - * Delete an existing event. + * Delete an existing Event. * - * This API is used for deleting a event. + * This API is used for deleting a event given its id. * * @param array $params * diff --git a/api/v3/Extension.php b/api/v3/Extension.php index 2dfbe7728a..138bcc0c99 100644 --- a/api/v3/Extension.php +++ b/api/v3/Extension.php @@ -29,7 +29,7 @@ define('API_V3_EXTENSION_DELIMITER', ','); /** - * This api exposes CiviCRM extension. + * This provides an api interface for CiviCRM extension management. * * @package CiviCRM_APIv3 */ @@ -97,9 +97,9 @@ function civicrm_api3_extension_upgrade() { * * @param array $params * Input parameters. - * - key: string, eg "com.example.myextension" - * - keys: mixed; array of string, eg array("com.example.myextension1", "com.example.myextension2") or string with comma-delimited list - * using 'keys' should be more performant than making multiple API calls with 'key' + * - key: string, eg "com.example.myextension" + * - keys: mixed; array of string, eg array("com.example.myextension1", "com.example.myextension2") or string with comma-delimited list + * using 'keys' should be more performant than making multiple API calls with 'key' * * @return array * API result @@ -165,8 +165,8 @@ function civicrm_api3_extension_uninstall($params) { * * @param array $params * Input parameters. - * - key: string, eg "com.example.myextension" - * - url: string eg "http://repo.com/myextension-1.0.zip" + * - key: string, eg "com.example.myextension" + * - url: string eg "http://repo.com/myextension-1.0.zip" * * @throws API_Exception * @return array @@ -215,8 +215,8 @@ function civicrm_api3_extension_download($params) { * * @param array $params * Input parameters. - * - local: bool, whether to rescan local filesystem (default: TRUE) - * - remote: bool, whether to rescan remote repository (default: TRUE) + * - local: bool, whether to rescan local filesystem (default: TRUE) + * - remote: bool, whether to rescan remote repository (default: TRUE) * * @return array * API result diff --git a/api/v3/File.php b/api/v3/File.php index b250075fd7..71f2492ef8 100644 --- a/api/v3/File.php +++ b/api/v3/File.php @@ -44,7 +44,6 @@ * Array per getfields metadata. * * @return array - * Array of newly created file property values. */ function civicrm_api3_file_create($params) { @@ -76,11 +75,11 @@ function civicrm_api3_file_create($params) { $file = array(); _civicrm_api3_object_to_array($fileDAO, $file); - return civicrm_api3_create_success($file, $params, 'file', 'create', $fileDAO); + return civicrm_api3_create_success($file, $params, 'File', 'create', $fileDAO); } /** - * Get a file. + * Get a File. * * @param array $params * Array per getfields metadata. @@ -94,7 +93,7 @@ function civicrm_api3_file_get($params) { } /** - * Update an existing file. + * Update an existing File. * * @param array $params * Array per getfields metadata. @@ -122,7 +121,7 @@ function civicrm_api3_file_update($params) { } /** - * Delete an existing file. + * Delete an existing File. * * @param array $params * Array per getfields metadata. diff --git a/api/v3/FinancialAccount.php b/api/v3/FinancialAccount.php index b22581290e..6efa65410b 100644 --- a/api/v3/FinancialAccount.php +++ b/api/v3/FinancialAccount.php @@ -26,37 +26,36 @@ */ /** - * This api exposes CiviCRM financial_account. + * This api exposes CiviCRM FinancialAccount. * * @package CiviCRM_APIv3 */ /** - * Save a financial_account. + * Save a FinancialAccount. * * @param array $params * * @return array - * Array of newly created financial_account property values. */ function civicrm_api3_financial_account_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** - * Get a financial_account. + * Get a FinancialAccount. * * @param array $params * * @return array - * Array of retrieved financial_account property values. + * Array of retrieved FinancialAccount property values. */ function civicrm_api3_financial_account_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** - * Delete a financial_account. + * Delete a FinancialAccount. * * @param array $params * diff --git a/api/v3/FinancialType.php b/api/v3/FinancialType.php index 96e4deb660..f1af35e4d6 100644 --- a/api/v3/FinancialType.php +++ b/api/v3/FinancialType.php @@ -26,37 +26,36 @@ */ /** - * This api exposes CiviCRM financial_type. + * This api exposes CiviCRM FinancialType. * * @package CiviCRM_APIv3 */ /** - * Save a financial_type. + * Save a FinancialType. * * @param array $params * * @return array - * Array of newly created financial_type property values. */ function civicrm_api3_financial_type_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** - * Get a financial_type. + * Get a FinancialType. * * @param array $params * * @return array - * Array of retrieved financial_type property values. + * Array of retrieved FinancialType property values. */ function civicrm_api3_financial_type_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** - * Delete a financial_type. + * Delete a FinancialType. * * @param array $params * diff --git a/api/v3/Grant.php b/api/v3/Grant.php index bb0468fbbd..d923db910b 100644 --- a/api/v3/Grant.php +++ b/api/v3/Grant.php @@ -26,7 +26,7 @@ */ /** - * This api exposes CiviCRM grant records. + * This api exposes CiviCRM Grant records. * * @note Grant component must be enabled. * @@ -34,13 +34,12 @@ */ /** - * Create/update grant. + * Create/update Grant. * * @param array $params * Array per getfields metadata. * * @return array - * grant array */ function civicrm_api3_grant_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Grant'); @@ -73,10 +72,10 @@ function civicrm_api3_grant_get($params) { } /** - * This method is used to delete an existing grant. + * This method is used to delete an existing Grant. * * @param array $params - * Id of the grant to be deleted is required. + * Id of the Grant to be deleted is required. * * @return array * API Result Array diff --git a/api/v3/Group.php b/api/v3/Group.php index 59ab73fcf4..3f3fe7a932 100644 --- a/api/v3/Group.php +++ b/api/v3/Group.php @@ -26,10 +26,10 @@ */ /** - * This api exposes CiviCRM groups. + * This api exposes CiviCRM Groups. * * This api is for creating/deleting groups or fetching a list of existing groups. - * To add/remove contacts to a group, use the groupContact api instead. + * To add/remove contacts to a group, use the GroupContact api instead. * * @package CiviCRM_APIv3 */ @@ -38,7 +38,7 @@ * Create/update group. * * @param array $params - * name/value pairs to insert in new 'group' + * name/value pairs to insert in new 'Group' * * @return array * API result array @@ -61,7 +61,7 @@ function _civicrm_api3_group_create_spec(&$params) { } /** - * Returns array of groups matching a set of one or more group properties. + * Returns array of groups matching a set of one or more Group properties. * * @param array $params * Array of properties. If empty, all records will be returned. @@ -70,7 +70,7 @@ function _civicrm_api3_group_create_spec(&$params) { * Array of matching groups */ function civicrm_api3_group_get($params) { - $options = _civicrm_api3_get_options_from_params($params, TRUE, 'group', 'get'); + $options = _civicrm_api3_get_options_from_params($params, TRUE, 'Group', 'get'); if (empty($options['return']) || !in_array('member_count', $options['return'])) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Group'); } @@ -79,11 +79,11 @@ function civicrm_api3_group_get($params) { foreach ($groups as $id => $group) { $groups[$id]['member_count'] = CRM_Contact_BAO_Group::memberCount($id); } - return civicrm_api3_create_success($groups, $params, 'group', 'get'); + return civicrm_api3_create_success($groups, $params, 'Group', 'get'); } /** - * Delete an existing group. + * Delete an existing Group. * * @param array $params * [id] diff --git a/api/v3/GroupContact.php b/api/v3/GroupContact.php index 601efd2bc4..024dae3339 100644 --- a/api/v3/GroupContact.php +++ b/api/v3/GroupContact.php @@ -26,13 +26,13 @@ */ /** - * This api exposes CiviCRM group contacts. + * This api exposes CiviCRM GroupContact records. * * This api is for adding/removing contacts from a group, * or fetching a list of groups for a contact. * * Important note: This api does not fetch smart groups for a contact. - * To fetch all contacts in a smart group, use the contact api + * To fetch all contacts in a smart group, use the Contact api * passing a contact_id and group_id. * * To create/delete groups, use the group api instead. @@ -40,11 +40,12 @@ * @package CiviCRM_APIv3 */ - /** - * This API will give list of the groups for particular contact. + * Fetch a list of groups for a contact, or contacts for a group. * - * Particular status can be sent in params array. + * @Note: this only applies to static groups, not smart groups. + * To fetch all contacts in a smart group, use the Contact api + * passing a contact_id and group_id. * * If no status mentioned in params, by default 'added' will be used * to fetch the records @@ -69,7 +70,7 @@ function civicrm_api3_group_contact_get($params) { $groupId = CRM_Utils_Array::value('group_id', $params); $values = &CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], $status, NULL, FALSE, TRUE, FALSE, TRUE, $groupId); - return civicrm_api3_create_success($values, $params); + return civicrm_api3_create_success($values, $params, 'GroupContact'); } /** @@ -230,8 +231,9 @@ function _civicrm_api3_group_contact_common($params, $op = 'Added') { $extraReturnValues['not_removed'] += $nr; } } - $dao = NULL;// can't pass this by reference - return civicrm_api3_create_success(1, $params, 'group_contact', 'create', $dao, $extraReturnValues); + // can't pass this by reference + $dao = NULL; + return civicrm_api3_create_success(1, $params, 'GroupContact', 'create', $dao, $extraReturnValues); } /** diff --git a/api/v3/GroupNesting.php b/api/v3/GroupNesting.php index db88e2b268..c5aa99c3fd 100644 --- a/api/v3/GroupNesting.php +++ b/api/v3/GroupNesting.php @@ -26,7 +26,7 @@ */ /** - * This api exposes CiviCRM group nesting. + * This api exposes CiviCRM GroupNesting. * * This defines parent/child relationships between nested groups. * @@ -43,7 +43,6 @@ * list of group nesting records */ function civicrm_api3_group_nesting_get($params) { - return _civicrm_api3_basic_get('CRM_Contact_DAO_GroupNesting', $params); } @@ -60,12 +59,11 @@ function civicrm_api3_group_nesting_get($params) { * @todo Work out the return value. */ function civicrm_api3_group_nesting_create($params) { - CRM_Contact_BAO_GroupNesting::add($params['parent_group_id'], $params['child_group_id']); // FIXME: CRM_Contact_BAO_GroupNesting requires some work $result = array('is_error' => 0); - return civicrm_api3_create_success($result, $params); + return civicrm_api3_create_success($result, $params, 'GroupNesting'); } /** @@ -92,6 +90,5 @@ function _civicrm_api3_group_nesting_create_spec(&$params) { * @todo Work out the return value. */ function civicrm_api3_group_nesting_delete($params) { - return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); } diff --git a/api/v3/GroupOrganization.php b/api/v3/GroupOrganization.php index 73a6437855..14b23fa287 100644 --- a/api/v3/GroupOrganization.php +++ b/api/v3/GroupOrganization.php @@ -62,7 +62,7 @@ function civicrm_api3_group_organization_create($params) { } _civicrm_api3_object_to_array($groupOrgBAO, $values); - return civicrm_api3_create_success($values, $params, 'group_organization', 'get', $groupOrgBAO); + return civicrm_api3_create_success($values, $params, 'GroupOrganization', 'get', $groupOrgBAO); } /** diff --git a/api/v3/Im.php b/api/v3/Im.php index 785102fd2f..a5e3010cb4 100644 --- a/api/v3/Im.php +++ b/api/v3/Im.php @@ -26,7 +26,7 @@ */ /** - * This api exposes CiviCRM IM. + * This api exposes CiviCRM IM records. * * @package CiviCRM_APIv3 */ @@ -37,7 +37,6 @@ * @param array $params * * @return array - * Array of newly created IM property values. */ function civicrm_api3_im_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); diff --git a/api/v3/Job.php b/api/v3/Job.php index 1f554eda0f..c22003c6b4 100644 --- a/api/v3/Job.php +++ b/api/v3/Job.php @@ -26,7 +26,7 @@ */ /** - * This api is used for triggering scheduled "cron" jobs. + * This api is used for working with scheduled "cron" jobs. * * @package CiviCRM_APIv3 */ @@ -99,7 +99,7 @@ function civicrm_api3_job_execute($params) { $facility->execute(FALSE); // Always creates success - results are handled elsewhere. - return civicrm_api3_create_success(1, $params); + return civicrm_api3_create_success(1, $params, 'Job'); } /** @@ -302,7 +302,7 @@ function civicrm_api3_job_process_mailing($params) { } else { $values = array(); - return civicrm_api3_create_success($values, $params, 'mailing', 'process'); + return civicrm_api3_create_success($values, $params, 'Job', 'process_mailing'); } } @@ -319,7 +319,7 @@ function civicrm_api3_job_process_sms($params) { } else { $values = array(); - return civicrm_api3_create_success($values, $params, 'mailing', 'process'); + return civicrm_api3_create_success($values, $params, 'Job', 'process_sms'); } } @@ -343,7 +343,7 @@ function civicrm_api3_job_fetch_bounces($params) { // FIXME: processBounces doesn't return true/false on success/failure $values = array(); - return civicrm_api3_create_success($values, $params, 'mailing', 'bounces'); + return civicrm_api3_create_success($values, $params, 'Job', 'fetch_bounces'); } /** @@ -363,7 +363,7 @@ function civicrm_api3_job_fetch_activities($params) { CRM_Utils_Mail_EmailProcessor::processActivities(); $values = array(); $lock->release(); - return civicrm_api3_create_success($values, $params, 'mailing', 'activities'); + return civicrm_api3_create_success($values, $params, 'Job', 'fetch_activities'); } catch (Exception $e) { $lock->release(); @@ -416,7 +416,7 @@ function civicrm_api3_job_process_membership($params) { $lock->release(); if ($result['is_error'] == 0) { - return civicrm_api3_create_success($result['messages'], $params); + return civicrm_api3_create_success($result['messages'], $params, 'Job', 'process_membership'); } else { return civicrm_api3_create_error($result['messages']); @@ -576,7 +576,7 @@ function civicrm_api3_job_disable_expired_relationships($params) { if (!$result) { throw new API_Exception('Failed to disable all expired relationships.'); } - return civicrm_api3_create_success(1, $params); + return civicrm_api3_create_success(1, $params, 'Job', 'disable_expired_relationships'); } /** diff --git a/api/v3/LineItem.php b/api/v3/LineItem.php index d5ca8d62c7..5070b9a123 100644 --- a/api/v3/LineItem.php +++ b/api/v3/LineItem.php @@ -27,7 +27,9 @@ /** - * This api exposes CiviCRM line item. + * This api exposes CiviCRM LineItem records. + * + * Line items are sub-components of a complete financial transaction record. * * @package CiviCRM_APIv3 */ @@ -77,10 +79,9 @@ function civicrm_api3_line_item_get($params) { } /** - * Delete an existing line_item. + * Delete an existing LineItem. * - * This method is used to delete any existing line_item. id of the group - * to be deleted is required field in $params array + * This method is used to delete any existing LineItem given its id. * * @param array $params * Array containing id of the group to be deleted. diff --git a/api/v3/LocBlock.php b/api/v3/LocBlock.php index ccd3633b72..e12721a788 100644 --- a/api/v3/LocBlock.php +++ b/api/v3/LocBlock.php @@ -27,16 +27,16 @@ /** - * This api exposes CiviCRM loc_block. + * This api exposes CiviCRM LocBlock records. * * @package CiviCRM_APIv3 */ /** - * Create or update a loc_block. + * Create or update a LocBlock. * * @param array $params - * name/value pairs to insert in new 'loc_block' + * name/value pairs to insert in new 'LocBlock' * * @return array * API result array. @@ -76,7 +76,7 @@ function civicrm_api3_loc_block_create($params) { if (!empty($dao->id)) { $values = array($dao->id => $entities); _civicrm_api3_object_to_array($dao, $values[$dao->id]); - return civicrm_api3_create_success($values, $params, 'loc_block', 'create', $dao); + return civicrm_api3_create_success($values, $params, 'LocBlock', 'create', $dao); } return civicrm_api3_create_error('Unable to create LocBlock. Please check your params.'); } @@ -111,13 +111,13 @@ function civicrm_api3_loc_block_get($params) { } $values[$val['id']] = $val; } - return civicrm_api3_create_success($values, $params, 'loc_block', 'get'); + return civicrm_api3_create_success($values, $params, 'LocBlock', 'get'); } return _civicrm_api3_basic_get('CRM_Core_DAO_LocBlock', $params); } /** - * Delete an existing loc_block. + * Delete an existing LocBlock. * * @param array $params * Array containing id of the record to be deleted. diff --git a/api/v3/LocationType.php b/api/v3/LocationType.php index 5293a445e8..45618e6cce 100644 --- a/api/v3/LocationType.php +++ b/api/v3/LocationType.php @@ -26,13 +26,13 @@ */ /** - * This api exposes CiviCRM location type. + * This api exposes CiviCRM LocationType records. * * @package CiviCRM_APIv3 */ /** - * Add a Location Type. + * Add a LocationType. * * @param array $params * @@ -62,7 +62,7 @@ function _civicrm_api3_location_type_create_spec(&$params) { } /** - * Deletes an existing Location Type. + * Deletes an existing LocationType. * * @param array $params * @@ -74,7 +74,7 @@ function civicrm_api3_location_type_delete($params) { } /** - * Retrieve one or more Location Types. + * Retrieve one or more LocationTypes. * * @param array $params * An associative array of name/value pairs. diff --git a/api/v3/MailSettings.php b/api/v3/MailSettings.php index c0c6e40849..686e9acb23 100644 --- a/api/v3/MailSettings.php +++ b/api/v3/MailSettings.php @@ -32,10 +32,10 @@ */ /** - * Create or update a mail_settings. + * Create or update a MailSettings. * * @param array $params - * name/value pairs to insert in new 'mail_settings' + * name/value pairs to insert in new 'MailSettings' * * @return array * API result array. @@ -53,15 +53,14 @@ function civicrm_api3_mail_settings_create($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_mail_settings_create_spec(&$params) { - } /** - * Returns array of mail_settings matching a set of one or more group properties. + * Returns array of MailSettings matching a set of one or more properties. * * @param array $params * Array of one or more property_name=>value pairs. - * If $params is set as null, all mail_settings will be returned + * If $params is set as null, all MailSettings will be returned. * * @return array * API result array. @@ -71,7 +70,7 @@ function civicrm_api3_mail_settings_get($params) { } /** - * Delete an existing mail_settings. + * Delete an existing MailSettings. * * @param array $params * [id] diff --git a/api/v3/Mailing.php b/api/v3/Mailing.php index 74cf9e209d..71fb134ad7 100755 --- a/api/v3/Mailing.php +++ b/api/v3/Mailing.php @@ -235,8 +235,7 @@ function civicrm_api3_mailing_event_bounce($params) { return civicrm_api3_create_success($params); } else { - throw new API_Exception(ts('Queue event could not be found'), 'no_queue_event - '); + throw new API_Exception(ts('Queue event could not be found'), 'no_queue_event'); } } @@ -269,7 +268,7 @@ function _civicrm_api3_mailing_event_bounce_spec(&$params) { * @return array */ function civicrm_api3_mailing_event_confirm($params) { - return civicrm_api('mailing_event_confirm', 'create', $params); + return civicrm_api('MailingEventConfirm', 'create', $params); } /** diff --git a/api/v3/MailingComponent.php b/api/v3/MailingComponent.php index 3ff4c94085..db953772ed 100644 --- a/api/v3/MailingComponent.php +++ b/api/v3/MailingComponent.php @@ -26,13 +26,13 @@ */ /** - * This api exposes CiviCRM mailing_component. + * This api exposes CiviCRM MailingComponent. * * @package CiviCRM_APIv3 */ /** - * Save a mailing_component. + * Save a MailingComponent. * * @param array $params * @@ -45,7 +45,7 @@ function civicrm_api3_mailing_component_create($params) { } /** - * Get a mailing_component. + * Get a MailingComponent. * * @param array $params * @@ -57,7 +57,7 @@ function civicrm_api3_mailing_component_get($params) { } /** - * Delete a mailing_component. + * Delete a MailingComponent. * * @param array $params * diff --git a/api/v3/MailingContact.php b/api/v3/MailingContact.php index 7c61428709..4f1c563a46 100644 --- a/api/v3/MailingContact.php +++ b/api/v3/MailingContact.php @@ -43,6 +43,7 @@ function civicrm_api3_mailing_contact_get($params) { return civicrm_api3_create_success(_civicrm_api3_mailing_contact_getresults($params, FALSE)); } + /** * This is a wrapper for the functions that return the results from the 'quasi-entity' mailing contact. * diff --git a/api/v3/MailingEventQueue.php b/api/v3/MailingEventQueue.php index 0451abe9cf..ad63ec1c0a 100644 --- a/api/v3/MailingEventQueue.php +++ b/api/v3/MailingEventQueue.php @@ -32,7 +32,7 @@ */ /** - * Handle a confirm event. + * Handle a queue event. * * @param array $params * Array of property. diff --git a/api/v3/MailingGroup.php b/api/v3/MailingGroup.php index 5633e5876c..9129bc1bc0 100644 --- a/api/v3/MailingGroup.php +++ b/api/v3/MailingGroup.php @@ -40,7 +40,7 @@ * to indicate this entire api entity is deprecated */ function _civicrm_api3_mailing_group_deprecation() { - return 'The mailing_group api is deprecated. Use the mailing_event apis instead.'; + return 'The MailingGroup api is deprecated. Use the mailing_event apis instead.'; } /** @@ -155,5 +155,5 @@ function civicrm_api3_mailing_group_getfields($params) { unset($field['pseudoconstant']); } - return civicrm_api3_create_success($fields, $params, 'mailing_group', 'getfields'); + return civicrm_api3_create_success($fields, $params, 'MailingGroup', 'getfields'); } diff --git a/api/v3/MailingJob.php b/api/v3/MailingJob.php index fa25329aed..8d9855ef7c 100644 --- a/api/v3/MailingJob.php +++ b/api/v3/MailingJob.php @@ -33,7 +33,7 @@ */ /** - * Handle creation of a Mailing Job for a Mailing. + * Handle creation of a MailingJob for a Mailing. * * @param array $params * diff --git a/api/v3/MailingRecipients.php b/api/v3/MailingRecipients.php index 7dc5d770a7..fd657e3f9f 100644 --- a/api/v3/MailingRecipients.php +++ b/api/v3/MailingRecipients.php @@ -26,14 +26,14 @@ */ /** - * APIv3 functions for registering/processing mailing recipients. + * API for retrieving mailing recipients. * * @package CiviCRM_APIv3 */ /** - * Returns array of Mailing Recipients. + * Returns array of MailingRecipients. * * @param array $params * Array per getfields metadata. diff --git a/api/v3/Membership.php b/api/v3/Membership.php index 3152a1b0a4..63823a516c 100644 --- a/api/v3/Membership.php +++ b/api/v3/Membership.php @@ -27,13 +27,13 @@ /** * - * This api exposes CiviCRM membership contact. + * This api exposes CiviCRM membership contact records. * * @package CiviCRM_APIv3 */ /** - * Deletes an existing contact membership. + * Deletes an existing contact Membership. * * @param array $params * Array array holding id - Id of the contact membership to be deleted. @@ -131,7 +131,7 @@ function civicrm_api3_membership_create($params) { $membership = array(); _civicrm_api3_object_to_array($membershipBAO, $membership[$membershipBAO->id]); - return civicrm_api3_create_success($membership, $params, 'membership', 'create', $membershipBAO); + return civicrm_api3_create_success($membership, $params, 'Membership', 'create', $membershipBAO); } @@ -175,7 +175,7 @@ function _civicrm_api3_membership_get_spec(&$params) { } /** - * Get contact membership record. + * Get contact Membership record. * * This api will return the membership records for the contacts * having membership based on the relationship with the direct members. @@ -201,7 +201,7 @@ function civicrm_api3_membership_get($params) { $params['status_id'] = array('IN' => CRM_Member_BAO_MembershipStatus::getMembershipStatusCurrent()); } - $options = _civicrm_api3_get_options_from_params($params, TRUE, 'membership', 'get'); + $options = _civicrm_api3_get_options_from_params($params, TRUE, 'Membership', 'get'); if ($options['is_count']) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } @@ -214,11 +214,11 @@ function civicrm_api3_membership_get($params) { && !array_key_exists('relationship_name', $return) ) ) { - return civicrm_api3_create_success($membershipValues, $params, 'membership', 'get'); + return civicrm_api3_create_success($membershipValues, $params, 'Membership', 'get'); } $members = _civicrm_api3_membership_relationsship_get_customv2behaviour($params, $membershipValues, $contactID); - return civicrm_api3_create_success($members, $params, 'membership', 'get'); + return civicrm_api3_create_success($members, $params, 'Membership', 'get'); } /** diff --git a/api/v3/MembershipBlock.php b/api/v3/MembershipBlock.php index 75f4c5e2e8..c2d0ca450f 100644 --- a/api/v3/MembershipBlock.php +++ b/api/v3/MembershipBlock.php @@ -26,16 +26,16 @@ */ /** - * This api exposes CiviCRM membership block. + * This api exposes CiviCRM MembershipBlock records. * * @package CiviCRM_APIv3 */ /** - * API to Create or update a Membership Block. + * API to Create or update a MembershipBlock. * * @param array $params - * An associative array of name/value property values of civicrm_membership_block. + * An associative array of name/value property values of MembershipBlock. * * @return array * newly created or updated membership block property values. diff --git a/api/v3/MembershipStatus.php b/api/v3/MembershipStatus.php index 8ed1b6864b..f9105d30b1 100644 --- a/api/v3/MembershipStatus.php +++ b/api/v3/MembershipStatus.php @@ -38,7 +38,6 @@ * Array of name/value property values of civicrm_membership_status. * * @return array - * Array of newly created membership status property values. */ function civicrm_api3_membership_status_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); diff --git a/api/v3/Note.php b/api/v3/Note.php index d689fdefcb..07405667e5 100644 --- a/api/v3/Note.php +++ b/api/v3/Note.php @@ -73,7 +73,6 @@ function _civicrm_api3_note_create_spec(&$params) { * @return array */ function civicrm_api3_note_delete($params) { - $result = new CRM_Core_BAO_Note(); return $result->del($params['id']) ? civicrm_api3_create_success() : civicrm_api3_create_error('Error while deleting Note'); } @@ -89,7 +88,6 @@ function civicrm_api3_note_delete($params) { * if error an array with an error id and error message */ function civicrm_api3_note_get($params) { - return _civicrm_api3_basic_get('CRM_Core_BAO_Note', $params); } @@ -115,7 +113,6 @@ function _civicrm_api3_note_get_spec(&$params) { * Nested associative array beginning with direct children of given note. */ function &civicrm_api3_note_tree_get($params) { - civicrm_api3_verify_mandatory($params, NULL, array('id')); if (!is_numeric($params['id'])) { diff --git a/api/v3/OptionGroup.php b/api/v3/OptionGroup.php index e7d793709a..bbe9bd50db 100644 --- a/api/v3/OptionGroup.php +++ b/api/v3/OptionGroup.php @@ -27,7 +27,8 @@ /** * This api exposes CiviCRM option groups. - * Each group contains option values. + * + * OptionGroups are containers for option values. * * @package CiviCRM_APIv3 */ @@ -70,8 +71,7 @@ function _civicrm_api3_option_group_create_spec(&$params) { /** * Delete an existing Option Group. * - * This method is used to delete any existing Option Group. id of the group - * to be deleted is required field in $params array + * This method is used to delete any existing OptionGroup given its id. * * @param array $params * [id] diff --git a/api/v3/OptionValue.php b/api/v3/OptionValue.php index a47e8ebed5..cf0da59d0b 100644 --- a/api/v3/OptionValue.php +++ b/api/v3/OptionValue.php @@ -27,6 +27,7 @@ /** * This api exposes CiviCRM option values. + * * Values are grouped by "OptionGroup" * * @package CiviCRM_APIv3 @@ -61,7 +62,6 @@ function civicrm_api3_option_value_get($params) { * * @throws API_Exception * @return array - * Array of newly created option_value property values. */ function civicrm_api3_option_value_create($params) { $result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); diff --git a/api/v3/Participant.php b/api/v3/Participant.php index 654fb59d1d..8465807221 100644 --- a/api/v3/Participant.php +++ b/api/v3/Participant.php @@ -60,7 +60,7 @@ function civicrm_api3_participant_create($params) { } _civicrm_api3_object_to_array($participantBAO, $participant[$participantBAO->id]); - return civicrm_api3_create_success($participant, $params, 'participant', 'create', $participantBAO); + return civicrm_api3_create_success($participant, $params, 'Participant', 'create', $participantBAO); } /** @@ -158,9 +158,8 @@ function _civicrm_api3_participant_create_spec(&$params) { */ function civicrm_api3_participant_get($params) { $mode = CRM_Contact_BAO_Query::MODE_EVENT; - $entity = 'participant'; - list($dao, $query) = _civicrm_api3_get_query_object($params, $mode, $entity); + list($dao, $query) = _civicrm_api3_get_query_object($params, $mode, 'Participant'); $participant = array(); while ($dao->fetch()) { @@ -169,7 +168,7 @@ function civicrm_api3_participant_get($params) { _civicrm_api3_custom_data_get($participant[$dao->participant_id], 'Participant', $dao->participant_id, NULL); } - return civicrm_api3_create_success($participant, $params, 'participant', 'get', $dao); + return civicrm_api3_create_success($participant, $params, 'Participant', 'get', $dao); } /** diff --git a/api/v3/ParticipantPayment.php b/api/v3/ParticipantPayment.php index 92a47adbaf..dcade2067a 100644 --- a/api/v3/ParticipantPayment.php +++ b/api/v3/ParticipantPayment.php @@ -41,7 +41,6 @@ * An associative array of name/value property values of civicrm_participant_payment. * * @return array - * Array of newly created payment property values. */ function civicrm_api3_participant_payment_create($params) { diff --git a/api/v3/ParticipantStatusType.php b/api/v3/ParticipantStatusType.php index 23a4a74a13..7e53d26be9 100644 --- a/api/v3/ParticipantStatusType.php +++ b/api/v3/ParticipantStatusType.php @@ -64,8 +64,7 @@ function civicrm_api3_participant_status_type_get($params) { /** * Delete an existing participant_status. * - * This method is used to delete any existing participant_status. id of the group - * to be deleted is required field in $params array + * This method is used to delete any existing participant_status given its id. * * @param array $params * [id] diff --git a/api/v3/PaymentProcessor.php b/api/v3/PaymentProcessor.php index 54cdcabb87..a9b28266e6 100644 --- a/api/v3/PaymentProcessor.php +++ b/api/v3/PaymentProcessor.php @@ -37,7 +37,6 @@ * @param array $params * * @return array - * Array of newly created PaymentProcessor property values. */ function civicrm_api3_payment_processor_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); diff --git a/api/v3/PaymentProcessorType.php b/api/v3/PaymentProcessorType.php index 1e62e72144..8b66129433 100644 --- a/api/v3/PaymentProcessorType.php +++ b/api/v3/PaymentProcessorType.php @@ -50,7 +50,7 @@ function civicrm_api3_payment_processor_type_create($params) { _civicrm_api3_object_to_array($paymentProcessorType, $relType[$paymentProcessorType->id]); - return civicrm_api3_create_success($relType, $params, 'payment_processor_type', 'create', $paymentProcessorType); + return civicrm_api3_create_success($relType, $params, 'PaymentProcessorType', 'create', $paymentProcessorType); } /** @@ -100,5 +100,5 @@ function civicrm_api3_payment_processor_type_delete($params) { if (!$result) { return civicrm_api3_create_error('Could not delete payment processor type'); } - return civicrm_api3_create_success($result, $params, 'payment_processor_type', 'delete', $payProcTypeBAO); + return civicrm_api3_create_success($result, $params, 'PaymentProcessorType', 'delete', $payProcTypeBAO); } diff --git a/api/v3/Phone.php b/api/v3/Phone.php index 599ee8ce7c..6b7ca2c270 100644 --- a/api/v3/Phone.php +++ b/api/v3/Phone.php @@ -26,7 +26,7 @@ */ /** - * This api exposes CiviCRM phone. + * This api exposes CiviCRM phone records. * * @package CiviCRM_APIv3 */ @@ -38,7 +38,6 @@ * Array per getfields metadata. * * @return array - * Array of newly created phone property values. */ function civicrm_api3_phone_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Phone'); diff --git a/api/v3/Pledge.php b/api/v3/Pledge.php index 18e1acbed4..eb5949599c 100644 --- a/api/v3/Pledge.php +++ b/api/v3/Pledge.php @@ -60,7 +60,7 @@ function civicrm_api3_pledge_delete($params) { if (CRM_Pledge_BAO_Pledge::deletePledge($params['id'])) { return civicrm_api3_create_success(array( 'id' => $params['id'], - ), $params, 'pledge', 'delete'); + ), $params, 'Pledge', 'delete'); } else { return civicrm_api3_create_error('Could not delete pledge'); @@ -122,16 +122,15 @@ function _civicrm_api3_pledge_create_spec(&$params) { */ function civicrm_api3_pledge_get($params) { $mode = CRM_Contact_BAO_Query::MODE_PLEDGE; - $entity = 'pledge'; - list($dao, $query) = _civicrm_api3_get_query_object($params, $mode, $entity); + list($dao, $query) = _civicrm_api3_get_query_object($params, $mode, 'Pledge'); $pledge = array(); while ($dao->fetch()) { $pledge[$dao->pledge_id] = $query->store($dao); } - return civicrm_api3_create_success($pledge, $params, 'pledge', 'get', $dao); + return civicrm_api3_create_success($pledge, $params, 'Pledge', 'get', $dao); } /** diff --git a/api/v3/PledgePayment.php b/api/v3/PledgePayment.php index 7e39ff987c..3d4ff21c82 100644 --- a/api/v3/PledgePayment.php +++ b/api/v3/PledgePayment.php @@ -70,7 +70,7 @@ function civicrm_api3_pledge_payment_create($params) { //update pledge status CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($dao->pledge_id); - return civicrm_api3_create_success($result, $params, 'pledge_payment', 'create', $dao); + return civicrm_api3_create_success($result, $params, 'PledgePayment', 'create', $dao); } /** @@ -98,7 +98,7 @@ function _civicrm_api3_pledge_payment_create_spec(&$params) { function civicrm_api3_pledge_payment_delete($params) { if (CRM_Pledge_BAO_PledgePayment::del($params['id'])) { - return civicrm_api3_create_success(array('id' => $params['id']), $params, 'pledge_payment', 'delete'); + return civicrm_api3_create_success(array('id' => $params['id']), $params, 'PledgePayment', 'delete'); } else { return civicrm_api3_create_error('Could not delete payment'); diff --git a/api/v3/Premium.php b/api/v3/Premium.php index 52827ccc1e..2ae0961de3 100644 --- a/api/v3/Premium.php +++ b/api/v3/Premium.php @@ -26,7 +26,11 @@ */ /** - * This api exposes CiviCRM premium. + * This api exposes CiviCRM premiums. + * + * Premiums are used as incentive gifts on contribution pages. + * Premiums contain "Products" which has a separate api. + * Use chaining to create a premium and related products in one api call. * * @package CiviCRM_APIv3 */ @@ -38,7 +42,6 @@ * * @throws API_Exception * @return array - * Array of newly created premium property values. */ function civicrm_api3_premium_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); diff --git a/api/v3/PriceField.php b/api/v3/PriceField.php index e63a28cb79..724c022de5 100644 --- a/api/v3/PriceField.php +++ b/api/v3/PriceField.php @@ -29,6 +29,10 @@ /** * This api exposes CiviCRM price set fields. * + * PriceSets contain PriceFields, which may contain PriceFieldValues. + * Each has its own api. + * Use chaining to create a PriceSet and associated PriceFields and values in one api call. + * * @package CiviCRM_APIv3 */ @@ -74,8 +78,7 @@ function civicrm_api3_price_field_get($params) { /** * Delete an existing price_field. * - * This method is used to delete any existing price_field. id of the group - * to be deleted is required field in $params array + * This method is used to delete any existing price_field given its id. * * @param array $params * Array containing id of the group to be deleted. diff --git a/api/v3/PriceFieldValue.php b/api/v3/PriceFieldValue.php index a22cf7b3e3..37a93741d3 100644 --- a/api/v3/PriceFieldValue.php +++ b/api/v3/PriceFieldValue.php @@ -27,16 +27,19 @@ /** - * This api exposes CiviCRM price sets. + * This api exposes CiviCRM price field values. + * + * PriceFields may contain zero or more PriceFieldValues. + * Use chaining to create PriceFields and values in one api call. * * @package CiviCRM_APIv3 */ /** - * Create or update a price_field_value. + * Create or update a PriceFieldValue. * * @param array $params - * name/value pairs to insert in new 'price_field_value' + * name/value pairs to insert in new 'PriceFieldValue' * * @return array * API result array. @@ -51,7 +54,7 @@ function civicrm_api3_price_field_value_create($params) { $values = array(); _civicrm_api3_object_to_array($bao, $values[$bao->id]); - return civicrm_api3_create_success($values, $params, 'price_field_value', 'create', $bao); + return civicrm_api3_create_success($values, $params, 'PriceFieldValue', 'create', $bao); } @@ -71,7 +74,7 @@ function _civicrm_api3_price_field_value_create_spec(&$params) { } /** - * Returns array of price_field_values matching a set of one or more group properties. + * Returns array of PriceFieldValues matching a set of one or more group properties. * * @param array $params * Array of one or more valid property_name=>value pairs. If $params is set. @@ -85,10 +88,9 @@ function civicrm_api3_price_field_value_get($params) { } /** - * Delete an existing price_field_value. + * Delete an existing PriceFieldValue. * - * This method is used to delete any existing price_field_value. id of the group - * to be deleted is required field in $params array + * This method is used to delete any existing PriceFieldValue given its id. * * @param array $params * Array containing id of the group to be deleted. diff --git a/api/v3/PriceSet.php b/api/v3/PriceSet.php index 15061c4b92..17c11c12ea 100644 --- a/api/v3/PriceSet.php +++ b/api/v3/PriceSet.php @@ -27,16 +27,19 @@ /** - * This api exposes CiviCRM price sets. + * This api exposes CiviCRM Price Sets. + * + * PriceSets contain PriceFields (which have their own api). + * Use chaining to create a PriceSet and associated PriceFields in one api call. * * @package CiviCRM_APIv3 */ /** - * Create or update a price_set. + * Create or update a PriceSet. * * @param array $params - * name/value pairs to insert in new 'price_set' + * name/value pairs to insert in new 'PriceSet' * * @return array * api result array @@ -96,10 +99,9 @@ function civicrm_api3_price_set_get($params) { } /** - * Delete an existing price_set. + * Delete an existing PriceSet. * - * This method is used to delete any existing price_set. id of the group - * to be deleted is required field in $params array + * This method is used to delete any existing PriceSet given its id. * * @param array $params * Array containing id of the group to be deleted. diff --git a/api/v3/PrintLabel.php b/api/v3/PrintLabel.php index 7090991ce3..2c9535f73a 100644 --- a/api/v3/PrintLabel.php +++ b/api/v3/PrintLabel.php @@ -26,37 +26,36 @@ */ /** - * This api exposes CiviCRM print_label. + * This api exposes CiviCRM PrintLabel. * * @package CiviCRM_APIv3 */ /** - * Save a print_label. + * Save a PrintLabel. * * @param array $params * * @return array - * Array of newly created print_label property values. */ function civicrm_api3_print_label_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** - * Get a print_label. + * Get a PrintLabel. * * @param array $params * * @return array - * Array of retrieved print_label property values. + * Array of retrieved PrintLabel property values. */ function civicrm_api3_print_label_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** - * Delete a print_label. + * Delete a PrintLabel. * * @param array $params * diff --git a/api/v3/Product.php b/api/v3/Product.php index 56a767da29..7f51927e79 100644 --- a/api/v3/Product.php +++ b/api/v3/Product.php @@ -26,7 +26,10 @@ */ /** - * This api exposes CiviCRM product. + * This api exposes CiviCRM premium products. + * + * Premiums are used as incentive gifts on contribution pages. + * Use chaining to create a premium and related products in one api call. * * @package CiviCRM_APIv3 */ @@ -38,7 +41,6 @@ * * @throws API_Exception * @return array - * Array of newly created product property values. */ function civicrm_api3_product_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); diff --git a/api/v3/Profile.php b/api/v3/Profile.php index 5c4b21764e..adc6a64f7e 100644 --- a/api/v3/Profile.php +++ b/api/v3/Profile.php @@ -26,7 +26,9 @@ */ /** - * This api exposes CiviCRM activity profile. + * This api exposes CiviCRM profiles. + * + * Profiles are collections of fields used as forms, listings, search columns, etc. * * @package CiviCRM_APIv3 */ @@ -172,7 +174,7 @@ function civicrm_api3_profile_submit($params) { $contactParams = $activityParams = $missingParams = array(); - $profileFields = civicrm_api3('profile', 'getfields', array('action' => 'submit', 'profile_id' => $profileID)); + $profileFields = civicrm_api3('Profile', 'getfields', array('action' => 'submit', 'profile_id' => $profileID)); $profileFields = $profileFields['values']; if ($isContactActivityProfile) { civicrm_api3_verify_mandatory($params, NULL, array('activity_id')); @@ -332,15 +334,14 @@ function _civicrm_api3_profile_submit_spec(&$params, $apirequest) { } /** - * Set profile - deprecated. + * Update Profile field values. * * @deprecated - calling this function directly is deprecated as 'set' is not a clear action * use submit - * Update Profile field values. * * @param array $params * Array of property name/value. - * pairs to update profile field values + * pairs to update profile field values * * @return array * Updated Contact/ Activity object|CRM_Error @@ -350,14 +351,14 @@ function civicrm_api3_profile_set($params) { } /** - * Apply profile - deprecated. + * Apply profile. * * @deprecated - appears to be an internal function - should not be accessible via api * Provide formatted values for profile fields. * * @param array $params * Array of property name/value. - * pairs to profile field values + * pairs to profile field values * * @throws API_Exception * @return array @@ -366,7 +367,6 @@ function civicrm_api3_profile_set($params) { * @todo add test cases */ function civicrm_api3_profile_apply($params) { - $profileFields = CRM_Core_BAO_UFGroup::getFields($params['profile_id'], FALSE, NULL, diff --git a/api/v3/RelationshipType.php b/api/v3/RelationshipType.php index d4f3c39ec2..d6aec8659f 100644 --- a/api/v3/RelationshipType.php +++ b/api/v3/RelationshipType.php @@ -65,7 +65,7 @@ function civicrm_api3_relationship_type_create($params) { _civicrm_api3_object_to_array($relationType, $relType[$relationType->id]); - return civicrm_api3_create_success($relType, $params, 'relationship_type', 'create', $relationType); + return civicrm_api3_create_success($relType, $params, 'RelationshipType', 'create', $relationType); } /** diff --git a/api/v3/ReportInstance.php b/api/v3/ReportInstance.php index 53a9423287..d51bdaa722 100644 --- a/api/v3/ReportInstance.php +++ b/api/v3/ReportInstance.php @@ -50,7 +50,6 @@ function civicrm_api3_report_instance_get($params) { * @param array $params * * @return array - * Array of newly created report instance property values. */ function civicrm_api3_report_instance_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); diff --git a/api/v3/ReportTemplate.php b/api/v3/ReportTemplate.php index 1c21ded0b4..a65cbf2dc4 100644 --- a/api/v3/ReportTemplate.php +++ b/api/v3/ReportTemplate.php @@ -57,7 +57,6 @@ function civicrm_api3_report_template_get($params) { * @param array $params * * @return array - * Array of newly created option_value property values. */ function civicrm_api3_report_template_create($params) { require_once 'api/v3/OptionValue.php'; @@ -115,7 +114,7 @@ function civicrm_api3_report_template_delete($params) { function civicrm_api3_report_template_getrows($params) { civicrm_api3_verify_one_mandatory($params, NULL, array('report_id', 'instance_id')); list($rows, $instance, $metadata) = _civicrm_api3_report_template_getrows($params); - return civicrm_api3_create_success($rows, $params, 'report_template', 'getrows', CRM_Core_DAO::$_nullObject, $metadata); + return civicrm_api3_create_success($rows, $params, 'ReportTemplate', 'getrows', CRM_Core_DAO::$_nullObject, $metadata); } /** @@ -148,7 +147,7 @@ function _civicrm_api3_report_template_getrows($params) { $reportInstance->preProcess(); $reportInstance->setDefaultValues(FALSE); $reportInstance->setParams(array_merge($reportInstance->getDefaultValues(), $params)); - $options = _civicrm_api3_get_options_from_params($params, TRUE, 'report_template', 'get'); + $options = _civicrm_api3_get_options_from_params($params, TRUE, 'ReportTemplate', 'get'); $reportInstance->setLimitValue($options['limit']); $reportInstance->setOffsetValue($options['offset']); $reportInstance->beginPostProcessCommon(); @@ -182,7 +181,7 @@ function _civicrm_api3_report_template_getrows($params) { function civicrm_api3_report_template_getstatistics($params) { list($rows, $reportInstance, $metadata) = _civicrm_api3_report_template_getrows($params); $stats = $reportInstance->statistics($rows); - return civicrm_api3_create_success($stats, $params, 'report_template', 'getstatistics', CRM_Core_DAO::$_nullObject, $metadata); + return civicrm_api3_create_success($stats, $params, 'ReportTemplate', 'getstatistics', CRM_Core_DAO::$_nullObject, $metadata); } /** * Adjust metadata for template getrows action. diff --git a/api/v3/Setting.php b/api/v3/Setting.php index 53a39dfbc5..31b86e50eb 100644 --- a/api/v3/Setting.php +++ b/api/v3/Setting.php @@ -51,7 +51,7 @@ function civicrm_api3_setting_getfields($params) { 'description' => 'Settings Group. This is required if the setting is not stored in config', 'type' => CRM_Utils_Type::T_STRING), ); - return civicrm_api3_create_success($result, $params, 'setting', 'getfields'); + return civicrm_api3_create_success($result, $params, 'Setting', 'getfields'); } if (!empty($params['name'])) { //am of two minds about special handling for 'name' as opposed to other filters - but is does make most common @@ -71,7 +71,7 @@ function civicrm_api3_setting_getfields($params) { $specFunction($result); } } - return civicrm_api3_create_success($result, $params, 'setting', 'getfields'); + return civicrm_api3_create_success($result, $params, 'Setting', 'getfields'); } /** @@ -99,7 +99,7 @@ function _civicrm_api3_setting_getfields_spec(&$params) { * @throws \Exception */ function civicrm_api3_setting_getdefaults(&$params) { - $settings = civicrm_api3('setting', 'getfields', $params); + $settings = civicrm_api3('Setting', 'getfields', $params); $domains = _civicrm_api3_setting_getDomainArray($params); $defaults = array(); foreach ($domains as $domainID) { @@ -118,10 +118,10 @@ function civicrm_api3_setting_getdefaults(&$params) { print_r($noDefaults); } } - return civicrm_api3_create_success($defaults, $params, 'setting', 'getfields'); + return civicrm_api3_create_success($defaults, $params, 'Setting', 'getfields'); } /** - * Metadata for setting create function. + * Metadata for Setting create function. * * @param array $params * Parameters as passed to the API. @@ -144,8 +144,8 @@ function _civicrm_api3_setting_getdefaults_spec(&$params) { * @throws \Exception */ function civicrm_api3_setting_revert(&$params) { - $defaults = civicrm_api('setting', 'getdefaults', $params); - $fields = civicrm_api('setting', 'getfields', $params); + $defaults = civicrm_api('Setting', 'getdefaults', $params); + $fields = civicrm_api('Setting', 'getfields', $params); $fields = $fields['values']; $domains = _civicrm_api3_setting_getDomainArray($params); $result = array(); @@ -155,11 +155,11 @@ function civicrm_api3_setting_revert(&$params) { $valuesToRevert['version'] = $params['version']; $valuesToRevert['domain_id'] = $domainID; // note that I haven't looked at how the result would appear with multiple domains in play - $result = array_merge($result, civicrm_api('setting', 'create', $valuesToRevert)); + $result = array_merge($result, civicrm_api('Setting', 'create', $valuesToRevert)); } } - return civicrm_api3_create_success($result, $params, 'setting', 'revert'); + return civicrm_api3_create_success($result, $params, 'Setting', 'revert'); } /** @@ -188,7 +188,7 @@ function _civicrm_api3_setting_revert_spec(&$params) { * @throws \Exception */ function civicrm_api3_setting_fill(&$params) { - $defaults = civicrm_api3('setting', 'getdefaults', $params); + $defaults = civicrm_api3('Setting', 'getdefaults', $params); $domains = _civicrm_api3_setting_getDomainArray($params); $result = array(); foreach ($domains as $domainID) { @@ -196,13 +196,13 @@ function civicrm_api3_setting_fill(&$params) { 'version' => $params['version'], 'domain_id' => $domainID, ); - $existing = civicrm_api3('setting', 'get', $apiArray); + $existing = civicrm_api3('Setting', 'get', $apiArray); $valuesToFill = array_diff_key($defaults['values'][$domainID], $existing['values'][$domainID]); if (!empty($valuesToFill)) { - $result = array_merge($result, civicrm_api('setting', 'create', $valuesToFill + $apiArray)); + $result = array_merge($result, civicrm_api('Setting', 'create', $valuesToFill + $apiArray)); } } - return civicrm_api3_create_success($result, $params, 'setting', 'fill'); + return civicrm_api3_create_success($result, $params, 'Setting', 'fill'); } /** @@ -233,7 +233,7 @@ function _civicrm_api3_setting_fill_spec(&$params) { function civicrm_api3_setting_create($params) { $domains = _civicrm_api3_setting_getDomainArray($params); $result = CRM_Core_BAO_Setting::setItems($params, $domains); - return civicrm_api3_create_success($result, $params, 'setting', 'create'); + return civicrm_api3_create_success($result, $params, 'Setting', 'create'); } /** @@ -267,7 +267,7 @@ function _civicrm_api3_setting_create_spec(&$params) { function civicrm_api3_setting_get($params) { $domains = _civicrm_api3_setting_getDomainArray($params); $result = $result = CRM_Core_BAO_Setting::getItems($params, $domains, CRM_Utils_Array::value('return', $params, array())); - return civicrm_api3_create_success($result, $params, 'setting', 'get'); + return civicrm_api3_create_success($result, $params, 'Setting', 'get'); } /** * Metadata for setting create function. diff --git a/api/v3/SmsProvider.php b/api/v3/SmsProvider.php index 2be88fba14..8b55c7a36c 100644 --- a/api/v3/SmsProvider.php +++ b/api/v3/SmsProvider.php @@ -37,7 +37,6 @@ * @param array $params * * @return array - * Array of newly created sms_provider property values. */ function civicrm_api3_sms_provider_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); diff --git a/api/v3/Survey.php b/api/v3/Survey.php index 9bd314aed3..763bffe1e4 100644 --- a/api/v3/Survey.php +++ b/api/v3/Survey.php @@ -77,8 +77,7 @@ function civicrm_api3_survey_get($params) { /** * Delete an existing survey. * - * This method is used to delete any existing survey. id of the group - * to be deleted is required field in $params array + * This method is used to delete any existing survey given its id. * * @param array $params * [id] diff --git a/api/v3/SurveyRespondant.php b/api/v3/SurveyRespondant.php index 5ed5772afe..88b31c4923 100644 --- a/api/v3/SurveyRespondant.php +++ b/api/v3/SurveyRespondant.php @@ -38,10 +38,10 @@ * * @deprecated api notice * @return string - * to indicate this entire api entity is deprecated + * String output indicates this entire api entity as deprecated */ function _civicrm_api3_survey_respondant_deprecation() { - return 'The survey_respondant api is not currently supported.'; + return 'The SurveyRespondant api is not currently supported.'; } /** diff --git a/api/v3/UFJoin.php b/api/v3/UFJoin.php index 4964225e6a..714a2c14ac 100644 --- a/api/v3/UFJoin.php +++ b/api/v3/UFJoin.php @@ -44,7 +44,7 @@ function civicrm_api3_uf_join_create($params) { $ufJoin = CRM_Core_BAO_UFJoin::create($params); _civicrm_api3_object_to_array($ufJoin, $ufJoinArray[]); - return civicrm_api3_create_success($ufJoinArray, $params, 'uf_join', 'create'); + return civicrm_api3_create_success($ufJoinArray, $params, 'UFJoin', 'create'); } /** diff --git a/api/v3/Website.php b/api/v3/Website.php index 8ce2cfc0b2..703a55b8ef 100644 --- a/api/v3/Website.php +++ b/api/v3/Website.php @@ -46,7 +46,7 @@ function civicrm_api3_website_create($params) { $websiteBAO = CRM_Core_BAO_Website::add($params); $values = array(); _civicrm_api3_object_to_array($websiteBAO, $values[$websiteBAO->id]); - return civicrm_api3_create_success($values, $params, 'website', 'get'); + return civicrm_api3_create_success($values, $params, 'Website', 'get'); } /** @@ -81,11 +81,11 @@ function civicrm_api3_website_delete($params) { if ($websiteDAO->find()) { while ($websiteDAO->fetch()) { $websiteDAO->delete(); - return civicrm_api3_create_success(1, $params, 'website', 'delete'); + return civicrm_api3_create_success(1, $params, 'Website', 'delete'); } } else { - throw new API_Exception('Could not delete website with id ' . $websiteID); + throw new API_Exception('Could not delete Website with id ' . $websiteID); } } @@ -98,5 +98,5 @@ function civicrm_api3_website_delete($params) { * details of found websites */ function civicrm_api3_website_get($params) { - return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'website'); + return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Website'); } diff --git a/api/v3/WordReplacement.php b/api/v3/WordReplacement.php index 1398c82fa0..27998bced4 100644 --- a/api/v3/WordReplacement.php +++ b/api/v3/WordReplacement.php @@ -26,9 +26,9 @@ */ /** - * This api exposes CiviCRM word replacement. + * This api exposes CiviCRM WordReplacement records. * - * Word-replacements are used to globally alter strings in the CiviCRM UI. + * Word replacements are used to globally alter strings in the CiviCRM UI. * Note that the original source string is always English, regardless of language settings. * * @package CiviCRM_APIv3 @@ -44,10 +44,10 @@ */ function civicrm_api3_word_replacement_get($params) { $bao = new CRM_Core_BAO_WordReplacement(); - _civicrm_api3_dao_set_filter($bao, $params, TRUE, 'WordReplacement'); + _civicrm_api3_dao_set_filter($bao, $params, TRUE); $wordReplacements = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'WordReplacement'); - return civicrm_api3_create_success($wordReplacements, $params, 'word_replacement', 'get', $bao); + return civicrm_api3_create_success($wordReplacements, $params, 'WordReplacement', 'get', $bao); } @@ -75,10 +75,10 @@ function _civicrm_api3_word_replacement_create_spec(&$params) { } /** - * Delete an existing word_replacement. + * Delete an existing WordReplacement. * * @param array $params - * Array containing id of the word_replacement to be deleted. + * Array containing id of the WordReplacement to be deleted. * * @return array * API result array diff --git a/api/v3/utils.php b/api/v3/utils.php index 74c4755620..64bad5f89d 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -478,10 +478,10 @@ function _civicrm_api3_store_values(&$fields, &$params, &$values) { * @return array */ function _civicrm_api3_get_using_query_object($entity, $params, $additional_options = array(), $getCount = NULL) { - + $lowercase_entity = _civicrm_api_get_entity_name_from_camel($entity); // Convert id to e.g. contact_id - if (empty($params[$entity . '_id']) && isset($params['id'])) { - $params[$entity . '_id'] = $params['id']; + if (empty($params[$lowercase_entity . '_id']) && isset($params['id'])) { + $params[$lowercase_entity . '_id'] = $params['id']; } unset($params['id']); @@ -502,7 +502,7 @@ function _civicrm_api3_get_using_query_object($entity, $params, $additional_opti // we will filter query object against getfields $fields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => 'get')); // we need to add this in as earlier in this function 'id' was unset in favour of $entity_id - $fields['values'][$entity . '_id'] = array(); + $fields['values'][$lowercase_entity . '_id'] = array(); $varsToFilter = array('returnProperties', 'inputParams'); foreach ($varsToFilter as $varToFilter) { if (!is_array($$varToFilter)) { @@ -527,7 +527,7 @@ function _civicrm_api3_get_using_query_object($entity, $params, $additional_opti } if (substr($sort, 0, 2) == 'id') { - $sort = $entity . "_" . $sort; + $sort = $lowercase_entity . "_" . $sort; } $newParams = CRM_Contact_BAO_Query::convertFormValues($inputParams); @@ -613,16 +613,16 @@ function _civicrm_api3_get_query_object($params, $mode, $entity) { * @param CRM_Core_DAO $dao * @param array $params * @param bool $unique - * @param string $entity * * @throws API_Exception * @throws Exception */ -function _civicrm_api3_dao_set_filter(&$dao, $params, $unique = TRUE, $entity) { - $entity = substr($dao->__table, 8); - if (!empty($params[$entity . "_id"]) && empty($params['id'])) { +function _civicrm_api3_dao_set_filter(&$dao, $params, $unique = TRUE) { + $entity = _civicrm_api_get_entity_name_from_dao($dao); + $lowercase_entity = _civicrm_api_get_entity_name_from_camel($entity); + if (!empty($params[$lowercase_entity . "_id"]) && empty($params['id'])) { //if entity_id is set then treat it as ID (will be overridden by id if set) - $params['id'] = $params[$entity . "_id"]; + $params['id'] = $params[$lowercase_entity . "_id"]; } $allfields = _civicrm_api3_build_fields_array($dao, $unique); $fields = array_intersect(array_keys($allfields), array_keys($params)); @@ -1178,7 +1178,7 @@ function formatCheckBoxField(&$checkboxFieldValue, $customFieldLabel, $entity) { * * @param array $params * Associative array of property name/value. - * pairs to insert in new history. + * pairs to insert in new history. * @param string $daoName * @param bool $return * @@ -1247,7 +1247,7 @@ function _civicrm_api3_check_required_fields($params, $daoName, $return = FALSE) */ function _civicrm_api3_basic_get($bao_name, &$params, $returnAsSuccess = TRUE, $entity = "") { $bao = new $bao_name(); - _civicrm_api3_dao_set_filter($bao, $params, TRUE, $entity); + _civicrm_api3_dao_set_filter($bao, $params, TRUE); if ($returnAsSuccess) { return civicrm_api3_create_success(_civicrm_api3_dao_to_array($bao, $params, FALSE, $entity), $params, $entity, 'get'); } @@ -1272,7 +1272,7 @@ function _civicrm_api3_basic_get($bao_name, &$params, $returnAsSuccess = TRUE, $ function _civicrm_api3_basic_create($bao_name, &$params, $entity = NULL) { _civicrm_api3_format_params_for_create($params, $entity); $args = array(&$params); - if (!empty($entity)) { + if ($entity) { $ids = array($entity => CRM_Utils_Array::value('id', $params)); $args[] = &$ids; }