本文整理汇总了PHP中CRM_Core_BAO_PrevNextCache::refillCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_PrevNextCache::refillCache方法的具体用法?PHP CRM_Core_BAO_PrevNextCache::refillCache怎么用?PHP CRM_Core_BAO_PrevNextCache::refillCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_PrevNextCache
的用法示例。
在下文中一共展示了CRM_Core_BAO_PrevNextCache::refillCache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: batchMerge
/**
* Batch merge a set of contacts based on rule-group and group.
*
* @param int $rgid
* Rule group id.
* @param int $gid
* Group id.
* @param string $mode
* Helps decide how to behave when there are conflicts.
* A 'safe' value skips the merge if there are any un-resolved conflicts.
* Does a force merge otherwise.
* @param bool $autoFlip to let api decide which contact to retain and which to delete.
* Wether to let api decide which contact to retain and which to delete.
* @param bool $redirectForPerformance
*
* @return array|bool
*/
public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $autoFlip = TRUE, $redirectForPerformance = FALSE)
{
$contactType = CRM_Core_DAO::getFieldValue('CRM_Dedupe_DAO_RuleGroup', $rgid, 'contact_type');
$cacheKeyString = "merge {$contactType}";
$cacheKeyString .= $rgid ? "_{$rgid}" : '_0';
$cacheKeyString .= $gid ? "_{$gid}" : '_0';
$join = "LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 = de.contact_id1 AND\n pn.entity_id2 = de.contact_id2 )";
$limit = $redirectForPerformance ? 75 : 1;
$where = "de.id IS NULL LIMIT {$limit}";
$dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where);
if (empty($dupePairs) && !$redirectForPerformance) {
// If we haven't found any dupes, probably cache is empty.
// Try filling cache and give another try.
CRM_Core_BAO_PrevNextCache::refillCache($rgid, $gid, $cacheKeyString);
$dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where);
}
$cacheParams = array('cache_key_string' => $cacheKeyString, 'join' => $join, 'where' => $where);
return CRM_Dedupe_Merger::merge($dupePairs, $cacheParams, $mode, $autoFlip, $redirectForPerformance);
}
示例2: getDuplicatePairs
/**
* Get Duplicate Pairs based on a rule for a group.
*
* @param int $rule_group_id
* @param int $group_id
* @param bool $reloadCacheIfEmpty
* @param int $batchLimit
* @param bool $isSelected
* @param array|string $orderByClause
* @param bool $includeConflicts
* @param array $criteria
* Additional criteria to narrow down the merge group.
*
* @param bool $checkPermissions
* Respect logged in user permissions.
*
* @return array
* Array of matches meeting the criteria.
*/
public static function getDuplicatePairs($rule_group_id, $group_id, $reloadCacheIfEmpty, $batchLimit, $isSelected, $orderByClause = '', $includeConflicts = TRUE, $criteria = array(), $checkPermissions = TRUE)
{
$where = self::getWhereString($batchLimit, $isSelected);
$cacheKeyString = self::getMergeCacheKeyString($rule_group_id, $group_id, $criteria, $checkPermissions);
$join = self::getJoinOnDedupeTable();
$dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, 0, 0, array(), $orderByClause, $includeConflicts);
if (empty($dupePairs) && $reloadCacheIfEmpty) {
// If we haven't found any dupes, probably cache is empty.
// Try filling cache and give another try. We don't need to specify include conflicts here are there will not be any
// until we have done some processing.
CRM_Core_BAO_PrevNextCache::refillCache($rule_group_id, $group_id, $cacheKeyString, $criteria, $checkPermissions);
$dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, 0, 0, array(), $orderByClause, $includeConflicts);
return $dupePairs;
}
return $dupePairs;
}