本文整理汇总了PHP中CRM_Event_DAO_Participant::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_DAO_Participant::delete方法的具体用法?PHP CRM_Event_DAO_Participant::delete怎么用?PHP CRM_Event_DAO_Participant::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Event_DAO_Participant
的用法示例。
在下文中一共展示了CRM_Event_DAO_Participant::delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteParticipant
/**
* Delete the records that are associated with this participation.
*
* @param int $id
* Id of the participation to delete.
*
* @return \CRM_Event_DAO_Participant
*/
public static function deleteParticipant($id)
{
CRM_Utils_Hook::pre('delete', 'Participant', $id, CRM_Core_DAO::$_nullArray);
$transaction = new CRM_Core_Transaction();
//delete activity record
$params = array('source_record_id' => $id, 'activity_type_id' => 5);
CRM_Activity_BAO_Activity::deleteActivity($params);
// delete the participant payment record
// we need to do this since the cascaded constraints
// dont work with join tables
$p = array('participant_id' => $id);
CRM_Event_BAO_ParticipantPayment::deleteParticipantPayment($p);
// cleanup line items.
$participantsId = array();
$participantsId = self::getAdditionalParticipantIds($id);
$participantsId[] = $id;
CRM_Price_BAO_LineItem::deleteLineItems($participantsId, 'civicrm_participant');
//delete note when participant deleted.
$note = CRM_Core_BAO_Note::getNote($id, 'civicrm_participant');
$noteId = key($note);
if ($noteId) {
CRM_Core_BAO_Note::del($noteId, FALSE);
}
$participant = new CRM_Event_DAO_Participant();
$participant->id = $id;
$participant->delete();
$transaction->commit();
CRM_Utils_Hook::post('delete', 'Participant', $participant->id, $participant);
// delete the recently created Participant
$participantRecent = array('id' => $id, 'type' => 'Participant');
CRM_Utils_Recent::del($participantRecent);
return $participant;
}
示例2: deleteParticipant
/**
* Delete the record that are associated with this participation
*
* @param int $id id of the participation to delete
*
* @return void
* @access public
* @static
*/
static function deleteParticipant($id)
{
require_once 'CRM/Core/Transaction.php';
$transaction = new CRM_Core_Transaction();
//delete activity record
require_once "CRM/Activity/BAO/Activity.php";
$params = array('source_record_id' => $id, 'activity_type_id' => 5);
// activity type id for event registration
CRM_Activity_BAO_Activity::deleteActivity($params);
// delete the participant payment record
// we need to do this since the cascaded constraints
// dont work with join tables
require_once 'CRM/Event/BAO/ParticipantPayment.php';
$p = array('participant_id' => $id);
CRM_Event_BAO_ParticipantPayment::deleteParticipantPayment($p);
// cleanup line items.
require_once 'CRM/Price/BAO/LineItem.php';
$participantsId = array();
$participantsId = self::getAdditionalParticipantIds($id);
$participantsId[] = $id;
CRM_Price_BAO_LineItem::deleteLineItems($participantsId, 'civicrm_participant');
$participant = new CRM_Event_DAO_Participant();
$participant->id = $id;
$participant->delete();
$transaction->commit();
// delete the recently created Participant
require_once 'CRM/Utils/Recent.php';
$participantRecent = array('id' => $id, 'type' => 'Participant');
CRM_Utils_Recent::del($participantRecent);
return $participant;
}