$participant->save();
if (!empty($params['contributionID'])) {
- $payment_params = [
+ $participantPaymentParams = [
'participant_id' => $participant->id,
'contribution_id' => $params['contributionID'],
];
- CRM_Event_BAO_ParticipantPayment::create($payment_params);
+ civicrm_api3('ParticipantPayment', 'create', $participantPaymentParams);
}
$transaction->commit();
$participants[0]->id,
'Participant'
);
- //add participant payment
- $paymentParticipant = [
+
+ // Add participant payment
+ $participantPaymentParams = [
'participant_id' => $participants[0]->id,
'contribution_id' => $contribution->id,
];
+ civicrm_api3('ParticipantPayment', 'create', $participantPaymentParams);
- CRM_Event_BAO_ParticipantPayment::create($paymentParticipant);
$this->_contactIds[] = $this->_contactId;
}
else {
}
}
- //insert payment record for this participation
+ // Insert payment record for this participant
if (empty($ids['contribution'])) {
foreach ($this->_contactIds as $num => $contactID) {
- $ppDAO = new CRM_Event_DAO_ParticipantPayment();
- $ppDAO->participant_id = $participants[$num]->id;
- $ppDAO->contribution_id = $contributions[$num]->id;
- $ppDAO->save();
+ $participantPaymentParams = [
+ 'participant_id' => $participants[$num]->id,
+ 'contribution_id' => $contributions[$num]->id,
+ ];
+ civicrm_api3('ParticipantPayment', 'create', $participantPaymentParams);
}
}
*
* @param int $contactID
* @param \CRM_Contribute_BAO_Contribution $contribution
+ *
+ * @throws \CiviCRM_API3_Exception
*/
public function confirmPostProcess($contactID = NULL, $contribution = NULL) {
// add/update contact information
}
if ($createPayment && $this->_values['event']['is_monetary'] && !empty($this->_params['contributionID'])) {
- $paymentParams = array(
+ $paymentParams = [
'participant_id' => $participant->id,
'contribution_id' => $contribution->id,
- );
- $paymentPartcipant = CRM_Event_BAO_ParticipantPayment::create($paymentParams);
+ ];
+ civicrm_api3('ParticipantPayment', 'create', $paymentParams);
}
$this->assign('action', $this->_action);
* @param int $contactID
*
* @return \CRM_Event_BAO_Participant
+ * @throws \CiviCRM_API3_Exception
*/
public static function addParticipant(&$form, $contactID) {
if (empty($form->_params)) {