Skip to content

Commit

Permalink
Minor api tidy up.
Browse files Browse the repository at this point in the history
It is recommended practice to pass the entity to the api. This minor fix up supports that
  • Loading branch information
eileenmcnaughton committed Jan 18, 2018
1 parent 543414a commit 98fd592
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion api/v3/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* API result array
*/
function civicrm_api3_acl_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Acl');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/AclRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* API result array
*/
function civicrm_api3_acl_role_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'AclRole');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/ActivityContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* API result array.
*/
function civicrm_api3_activity_contact_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ActivityContact');
}

/**
Expand Down
4 changes: 1 addition & 3 deletions api/v3/ContributionRecur.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@
* api result array
*/
function civicrm_api3_contribution_recur_create($params) {
_civicrm_api3_custom_format_params($params, $values, 'ContributionRecur');
$params = array_merge($params, $values);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ContributionRecur');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/CustomGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function civicrm_api3_custom_group_create($params) {
$params['extends_entity_column_value'] = CRM_Utils_Array::explodePadded($params['extends_entity_column_value']);
}

return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'CustomGroup');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/OptionValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function _civicrm_api3_option_value_get_spec(&$params) {
* API result array
*/
function civicrm_api3_option_value_create($params) {
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'OptionValue');
if (!empty($params['id']) && !array_key_exists('option_group_id', $params)) {
$groupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue',
$params['id'], 'option_group_id', 'id'
Expand Down
2 changes: 1 addition & 1 deletion api/v3/PaymentProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function civicrm_api3_payment_processor_create($params) {
'return' => 'payment_instrument_id',
));
}
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'PaymentProcesor');
}

/**
Expand Down
5 changes: 1 addition & 4 deletions api/v3/Pledge.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@
*/
function civicrm_api3_pledge_create($params) {
_civicrm_api3_pledge_format_params($params, TRUE);
$values = $params;
//format the custom fields
_civicrm_api3_custom_format_params($params, $values, 'Pledge');
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $values);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Pledge');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/PriceSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* api result array
*/
function civicrm_api3_price_set_create($params) {
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'PriceSet');
// Handle price_set_entity
if (!empty($result['id']) && !empty($params['entity_table']) && !empty($params['entity_id'])) {
$entityId = $params['entity_id'];
Expand Down
2 changes: 1 addition & 1 deletion api/v3/UFGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function _civicrm_api3_uf_group_create_spec(&$params) {
* API result array
*/
function civicrm_api3_uf_group_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'UFGroup');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/v3/UFMatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function civicrm_api3_uf_match_get($params) {
* Api result array
*/
function civicrm_api3_uf_match_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'UFMatch');
}

/**
Expand Down

0 comments on commit 98fd592

Please sign in to comment.