本文整理汇总了PHP中CRM_Member_PseudoConstant::flush方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Member_PseudoConstant::flush方法的具体用法?PHP CRM_Member_PseudoConstant::flush怎么用?PHP CRM_Member_PseudoConstant::flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Member_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Member_PseudoConstant::flush方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: del
/**
* Delete membership Types.
*
* @param int $membershipStatusId
*
* @throws CRM_Core_Exception
*/
public static function del($membershipStatusId)
{
//check dependencies
//checking if membership status is present in some other table
$check = FALSE;
$dependency = array('Membership', 'MembershipLog');
foreach ($dependency as $name) {
$baoString = 'CRM_Member_BAO_' . $name;
$dao = new $baoString();
$dao->status_id = $membershipStatusId;
if ($dao->find(TRUE)) {
throw new CRM_Core_Exception(ts('This membership status cannot be deleted as memberships exist with this status'));
}
}
CRM_Utils_Weight::delWeight('CRM_Member_DAO_MembershipStatus', $membershipStatusId);
//delete from membership Type table
$membershipStatus = new CRM_Member_DAO_MembershipStatus();
$membershipStatus->id = $membershipStatusId;
$membershipStatus->delete();
CRM_Member_PseudoConstant::flush('membershipStatus');
$membershipStatus->free();
}
示例2: membershipStatusCreate
/**
* @param string $name
*
* @return mixed
*/
public function membershipStatusCreate($name = 'test member status')
{
$params['name'] = $name;
$params['start_event'] = 'start_date';
$params['end_event'] = 'end_date';
$params['is_current_member'] = 1;
$params['is_active'] = 1;
$result = $this->callAPISuccess('MembershipStatus', 'Create', $params);
CRM_Member_PseudoConstant::flush('membershipStatus');
return $result['id'];
}