INFRA-132 - api - Convert single-line @param to multi-line
[civicrm-core.git] / api / v3 / MembershipPayment.php
index 147bb4dc7235f916b7ce5550e6c72bcd1a012187..8111ade36be5bc265fa609e6f7c29dffba3ec991 100644 (file)
@@ -1,11 +1,10 @@
 <?php
-// $Id$
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  * @package CiviCRM_APIv3
  * @subpackage API_Membership
  * @todo delete function doesn't exist
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * @version $Id: MembershipContributionLink.php 30171 2010-10-14 09:11:27Z mover $
  */
 
-/**
- * Include utility functions
- */
-
-require_once 'CRM/Member/DAO/MembershipPayment.php';
-
 /**
  * Add or update a link between contribution and membership
  *
- * @param  array   $params           (reference ) input parameters
+ * @param array $params
+ *   (reference ) input parameters.
  *
  * @return array (reference )        membership_payment_id of created or updated record
  * {@getfields MembershipPayment_create}
@@ -54,32 +48,15 @@ require_once 'CRM/Member/DAO/MembershipPayment.php';
  * @access public
  */
 function civicrm_api3_membership_payment_create($params) {
-
-  require_once 'CRM/Core/Transaction.php';
-  $transaction = new CRM_Core_Transaction();
-
-
-  $mpDAO = new CRM_Member_DAO_MembershipPayment();
-  $mpDAO->copyValues($params);
-  $result = $mpDAO->save();
-
-  if (is_a($result, 'CRM_Core_Error')) {
-    $transaction->rollback();
-    return civicrm_api3_create_error($result->_errors[0]['message']);
-  }
-
-  $transaction->commit();
-
-  _civicrm_api3_object_to_array($mpDAO, $mpArray[$mpDAO->id]);
-
-  return civicrm_api3_create_success($mpArray, $params);
+  return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }
 
 /**
  * Adjust Metadata for Create action
- * 
+ *
  * The metadata is used for setting defaults, documentation & validation
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ *   Array or parameters determined by getfields.
  */
 function _civicrm_api3_membership_payment_create_spec(&$params) {
   $params['membership_id']['api.required'] = 1;
@@ -90,7 +67,8 @@ function _civicrm_api3_membership_payment_create_spec(&$params) {
  * Retrieve one / all contribution(s) / membership(s) linked to a
  * membership / contrbution.
  *
- * @param  array   $params  input parameters
+ * @param array $params
+ *   Input parameters.
  *
  * @return array  array of properties, if error an array with an error id and error message
  *  @example MembershipPaymentGet
@@ -98,8 +76,6 @@ function _civicrm_api3_membership_payment_create_spec(&$params) {
  * @access public
  */
 function civicrm_api3_membership_payment_get($params) {
-
-
   return _civicrm_api3_basic_get('CRM_Member_DAO_MembershipPayment', $params);
 }