5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Dedupe/Rule.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:99420d466d2982510873b69c179fd9f5)
13 * Database access object for the Rule entity.
15 class CRM_Dedupe_DAO_Rule
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_dedupe_rule';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
32 * Unique dedupe rule id
39 * The id of the rule group this rule belongs to
43 public $dedupe_rule_group_id;
46 * The name of the table this rule is about
53 * The name of the field of the table referenced in rule_table
60 * The length of the matching substring
67 * The weight of the rule
76 public function __construct() {
77 $this->__table
= 'civicrm_dedupe_rule';
78 parent
::__construct();
82 * Returns foreign keys and entity references.
85 * [CRM_Core_Reference_Interface]
87 public static function getReferenceColumns() {
88 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
89 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
90 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id');
91 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
93 return Civi
::$statics[__CLASS__
]['links'];
97 * Returns all the column names of this table
101 public static function &fields() {
102 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
103 Civi
::$statics[__CLASS__
]['fields'] = [
106 'type' => CRM_Utils_Type
::T_INT
,
107 'title' => ts('Dedupe Rule ID'),
108 'description' => ts('Unique dedupe rule id'),
110 'where' => 'civicrm_dedupe_rule.id',
111 'table_name' => 'civicrm_dedupe_rule',
113 'bao' => 'CRM_Dedupe_BAO_Rule',
116 'dedupe_rule_group_id' => [
117 'name' => 'dedupe_rule_group_id',
118 'type' => CRM_Utils_Type
::T_INT
,
119 'title' => ts('Dedupe Rule Group'),
120 'description' => ts('The id of the rule group this rule belongs to'),
122 'where' => 'civicrm_dedupe_rule.dedupe_rule_group_id',
123 'table_name' => 'civicrm_dedupe_rule',
125 'bao' => 'CRM_Dedupe_BAO_Rule',
127 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup',
130 'name' => 'rule_table',
131 'type' => CRM_Utils_Type
::T_STRING
,
132 'title' => ts('Rule Table'),
133 'description' => ts('The name of the table this rule is about'),
136 'size' => CRM_Utils_Type
::BIG
,
137 'where' => 'civicrm_dedupe_rule.rule_table',
138 'table_name' => 'civicrm_dedupe_rule',
140 'bao' => 'CRM_Dedupe_BAO_Rule',
144 'name' => 'rule_field',
145 'type' => CRM_Utils_Type
::T_STRING
,
146 'title' => ts('Rule Field'),
147 'description' => ts('The name of the field of the table referenced in rule_table'),
150 'size' => CRM_Utils_Type
::BIG
,
151 'where' => 'civicrm_dedupe_rule.rule_field',
152 'table_name' => 'civicrm_dedupe_rule',
154 'bao' => 'CRM_Dedupe_BAO_Rule',
158 'name' => 'rule_length',
159 'type' => CRM_Utils_Type
::T_INT
,
160 'title' => ts('Rule Length'),
161 'description' => ts('The length of the matching substring'),
162 'where' => 'civicrm_dedupe_rule.rule_length',
163 'table_name' => 'civicrm_dedupe_rule',
165 'bao' => 'CRM_Dedupe_BAO_Rule',
172 'name' => 'rule_weight',
173 'type' => CRM_Utils_Type
::T_INT
,
174 'title' => ts('Order'),
175 'description' => ts('The weight of the rule'),
177 'where' => 'civicrm_dedupe_rule.rule_weight',
178 'table_name' => 'civicrm_dedupe_rule',
180 'bao' => 'CRM_Dedupe_BAO_Rule',
187 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
189 return Civi
::$statics[__CLASS__
]['fields'];
193 * Return a mapping from field-name to the corresponding key (as used in fields()).
196 * Array(string $name => string $uniqueName).
198 public static function &fieldKeys() {
199 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
200 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
202 return Civi
::$statics[__CLASS__
]['fieldKeys'];
206 * Returns the names of this table
210 public static function getTableName() {
211 return self
::$_tableName;
215 * Returns if this table needs to be logged
219 public function getLog() {
224 * Returns the list of fields that can be imported
226 * @param bool $prefix
230 public static function &import($prefix = FALSE) {
231 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'dedupe_rule', $prefix, []);
236 * Returns the list of fields that can be exported
238 * @param bool $prefix
242 public static function &export($prefix = FALSE) {
243 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'dedupe_rule', $prefix, []);
248 * Returns the list of indices
250 * @param bool $localize
254 public static function indices($localize = TRUE) {
256 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;