本文整理汇总了PHP中CRM_Dedupe_BAO_RuleGroup::thresholdQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Dedupe_BAO_RuleGroup::thresholdQuery方法的具体用法?PHP CRM_Dedupe_BAO_RuleGroup::thresholdQuery怎么用?PHP CRM_Dedupe_BAO_RuleGroup::thresholdQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Dedupe_BAO_RuleGroup
的用法示例。
在下文中一共展示了CRM_Dedupe_BAO_RuleGroup::thresholdQuery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dupesByParams
/**
* Return an array of possible dupes, based on the provided array of
* params, using the default rule group for the given contact type and
* level.
*
* check_permission is a boolean flag to indicate if permission should be considered.
* default is to always check permissioning but public pages for example might not want
* permission to be checked for anonymous users. Refer CRM-6211. We might be beaking
* Multi-Site dedupe for public pages.
*
* @param array $params array of params of the form $params[$table][$field] == $value
* @param string $ctype contact type to match against
* @param string $level dedupe rule group level ('Fuzzy' or 'Strict')
* @param array $except array of contacts that shouldn't be considered dupes
* @param int $ruleGroupID the id of the dedupe rule we should be using
*
* @return array matching contact ids
*/
static function dupesByParams($params, $ctype, $level = 'Strict', $except = array(), $ruleGroupID = NULL)
{
// If $params is empty there is zero reason to proceed.
if (!$params) {
return array();
}
$foundByID = FALSE;
if ($ruleGroupID) {
$rgBao = new CRM_Dedupe_BAO_RuleGroup();
$rgBao->id = $ruleGroupID;
$rgBao->contact_type = $ctype;
if ($rgBao->find(TRUE)) {
$foundByID = TRUE;
}
}
if (!$foundByID) {
$rgBao = new CRM_Dedupe_BAO_RuleGroup();
$rgBao->contact_type = $ctype;
$rgBao->level = $level;
$rgBao->is_default = 1;
if (!$rgBao->find(TRUE)) {
CRM_Core_Error::fatal("{$level} rule for {$ctype} does not exist");
}
}
$params['check_permission'] = CRM_Utils_Array::value('check_permission', $params, TRUE);
$rgBao->params = $params;
$rgBao->fillTable();
$dao = new CRM_Core_DAO();
$dao->query($rgBao->thresholdQuery($params['check_permission']));
$dupes = array();
while ($dao->fetch()) {
if (isset($dao->id) && $dao->id) {
$dupes[] = $dao->id;
}
}
$dao->query($rgBao->tableDropQuery());
return array_diff($dupes, $except);
}