本文整理汇总了PHP中CRM_Dedupe_BAO_Rule::sql方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Dedupe_BAO_Rule::sql方法的具体用法?PHP CRM_Dedupe_BAO_Rule::sql怎么用?PHP CRM_Dedupe_BAO_Rule::sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Dedupe_BAO_Rule
的用法示例。
在下文中一共展示了CRM_Dedupe_BAO_Rule::sql方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tableQuery
/**
* Return a set of SQL queries whose cummulative weights will mark matched
* records for the RuleGroup::threasholdQuery() to retrieve.
*/
public function tableQuery()
{
// make sure we've got a fetched dbrecord, not sure if this is enforced
if (!$this->name == NULL || $this->is_reserved == NULL) {
$this->find(TRUE);
}
// Reserved Rule Groups can optionally get special treatment by
// implementing an optimization class and returning a query array.
if ($this->is_reserved && CRM_Utils_File::isIncludable("CRM/Dedupe/BAO/QueryBuilder/{$this->name}.php")) {
include_once "CRM/Dedupe/BAO/QueryBuilder/{$this->name}.php";
$class = "CRM_Dedupe_BAO_QueryBuilder_{$this->name}";
$command = empty($this->params) ? 'internal' : 'record';
$queries = call_user_func(array($class, $command), $this);
} else {
// All other rule groups have queries generated by the member dedupe
// rules defined in the administrative interface.
// Find all rules contained by this script sorted by weight so that
// their execution can be short circuited on RuleGroup::fillTable()
$bao = new CRM_Dedupe_BAO_Rule();
$bao->dedupe_rule_group_id = $this->id;
$bao->orderBy('rule_weight DESC');
$bao->find();
// Generate a SQL query for each rule in the rule group that is
// tailored to respect the param and contactId options provided.
$queries = array();
while ($bao->fetch()) {
$bao->contactIds = $this->contactIds;
$bao->params = $this->params;
// Skipping empty rules? Empty rules shouldn't exist; why check?
if ($query = $bao->sql()) {
$queries["{$bao->rule_table}.{$bao->rule_field}.{$bao->rule_weight}"] = $query;
}
}
}
// if there are no rules in this rule group
// add an empty query fulfilling the pattern
if (!$queries) {
$queries = array('SELECT 0 id1, 0 id2, 0 weight LIMIT 0');
$this->noRules = TRUE;
}
return $queries;
}
示例2: tableQuery
/**
* Return the SQL query for creating the temporary table.
*/
function tableQuery()
{
require_once 'CRM/Dedupe/BAO/Rule.php';
$bao = new CRM_Dedupe_BAO_Rule();
$bao->dedupe_rule_group_id = $this->id;
$bao->orderBy('rule_weight DESC');
$bao->find();
$queries = array();
while ($bao->fetch()) {
$bao->contactIds = $this->contactIds;
$bao->params = $this->params;
if ($query = $bao->sql()) {
$queries["{$bao->rule_table}.{$bao->rule_field}.{$bao->rule_weight}"] = $query;
}
}
// if there are no rules in this rule group, add an empty query fulfilling the pattern
if (!$queries) {
$queries = array('SELECT 0 id1, 0 id2, 0 weight LIMIT 0');
$this->noRules = true;
}
return $queries;
}