Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Dedupe/Rule.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
449c4e6b | 9 | * (GenCodeChecksum:78004d786287419f4f322dd22c8e7daa) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Rule entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Dedupe_DAO_Rule extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
fa45b5b9 | 22 | public static $_tableName = 'civicrm_dedupe_rule'; |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
fa45b5b9 | 29 | public static $_log = FALSE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * Unique dedupe rule id | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * The id of the rule group this rule belongs to | |
40 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $dedupe_rule_group_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * The name of the table this rule is about | |
47 | * | |
48 | * @var string | |
49 | */ | |
50 | public $rule_table; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * The name of the field of the table referenced in rule_table | |
54 | * | |
55 | * @var string | |
56 | */ | |
57 | public $rule_field; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * The length of the matching substring | |
61 | * | |
e6ca0a57 | 62 | * @var int |
e501603b TO |
63 | */ |
64 | public $rule_length; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * The weight of the rule | |
68 | * | |
69 | * @var int | |
70 | */ | |
71 | public $rule_weight; | |
c3fc2621 | 72 | |
e501603b | 73 | /** |
f41f0342 | 74 | * Class constructor. |
e501603b | 75 | */ |
c3fc2621 | 76 | public function __construct() { |
e501603b TO |
77 | $this->__table = 'civicrm_dedupe_rule'; |
78 | parent::__construct(); | |
79 | } | |
c3fc2621 | 80 | |
449c4e6b CW |
81 | /** |
82 | * Returns localized title of this entity. | |
83 | */ | |
84 | public static function getEntityTitle() { | |
85 | return ts('Rules'); | |
86 | } | |
87 | ||
e501603b | 88 | /** |
f41f0342 | 89 | * Returns foreign keys and entity references. |
e501603b TO |
90 | * |
91 | * @return array | |
92 | * [CRM_Core_Reference_Interface] | |
93 | */ | |
c3fc2621 | 94 | public static function getReferenceColumns() { |
346aaaba | 95 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 96 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 97 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id'); |
346aaaba | 98 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 99 | } |
346aaaba | 100 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 101 | } |
c3fc2621 | 102 | |
e501603b TO |
103 | /** |
104 | * Returns all the column names of this table | |
105 | * | |
106 | * @return array | |
107 | */ | |
c3fc2621 | 108 | public static function &fields() { |
346aaaba | 109 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
110 | Civi::$statics[__CLASS__]['fields'] = [ |
111 | 'id' => [ | |
e501603b TO |
112 | 'name' => 'id', |
113 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 114 | 'title' => ts('Dedupe Rule ID'), |
215b423e | 115 | 'description' => ts('Unique dedupe rule id'), |
c3fc2621 | 116 | 'required' => TRUE, |
a36434b9 | 117 | 'where' => 'civicrm_dedupe_rule.id', |
522a26c9 | 118 | 'table_name' => 'civicrm_dedupe_rule', |
119 | 'entity' => 'Rule', | |
120 | 'bao' => 'CRM_Dedupe_BAO_Rule', | |
6a7e5e5d | 121 | 'localizable' => 0, |
c3fc2621 CW |
122 | ], |
123 | 'dedupe_rule_group_id' => [ | |
e501603b TO |
124 | 'name' => 'dedupe_rule_group_id', |
125 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 126 | 'title' => ts('Dedupe Rule Group'), |
215b423e | 127 | 'description' => ts('The id of the rule group this rule belongs to'), |
c3fc2621 | 128 | 'required' => TRUE, |
a36434b9 | 129 | 'where' => 'civicrm_dedupe_rule.dedupe_rule_group_id', |
522a26c9 | 130 | 'table_name' => 'civicrm_dedupe_rule', |
131 | 'entity' => 'Rule', | |
132 | 'bao' => 'CRM_Dedupe_BAO_Rule', | |
6a7e5e5d | 133 | 'localizable' => 0, |
e501603b | 134 | 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup', |
c3fc2621 CW |
135 | ], |
136 | 'rule_table' => [ | |
e501603b TO |
137 | 'name' => 'rule_table', |
138 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 139 | 'title' => ts('Rule Table'), |
215b423e | 140 | 'description' => ts('The name of the table this rule is about'), |
c3fc2621 | 141 | 'required' => TRUE, |
e501603b TO |
142 | 'maxlength' => 64, |
143 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 144 | 'where' => 'civicrm_dedupe_rule.rule_table', |
522a26c9 | 145 | 'table_name' => 'civicrm_dedupe_rule', |
146 | 'entity' => 'Rule', | |
147 | 'bao' => 'CRM_Dedupe_BAO_Rule', | |
6a7e5e5d | 148 | 'localizable' => 0, |
c3fc2621 CW |
149 | ], |
150 | 'rule_field' => [ | |
e501603b TO |
151 | 'name' => 'rule_field', |
152 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 153 | 'title' => ts('Rule Field'), |
215b423e | 154 | 'description' => ts('The name of the field of the table referenced in rule_table'), |
c3fc2621 | 155 | 'required' => TRUE, |
e501603b TO |
156 | 'maxlength' => 64, |
157 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 158 | 'where' => 'civicrm_dedupe_rule.rule_field', |
522a26c9 | 159 | 'table_name' => 'civicrm_dedupe_rule', |
160 | 'entity' => 'Rule', | |
161 | 'bao' => 'CRM_Dedupe_BAO_Rule', | |
6a7e5e5d | 162 | 'localizable' => 0, |
c3fc2621 CW |
163 | ], |
164 | 'rule_length' => [ | |
e501603b TO |
165 | 'name' => 'rule_length', |
166 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 167 | 'title' => ts('Rule Length'), |
215b423e | 168 | 'description' => ts('The length of the matching substring'), |
a36434b9 | 169 | 'where' => 'civicrm_dedupe_rule.rule_length', |
522a26c9 | 170 | 'table_name' => 'civicrm_dedupe_rule', |
171 | 'entity' => 'Rule', | |
172 | 'bao' => 'CRM_Dedupe_BAO_Rule', | |
6a7e5e5d | 173 | 'localizable' => 0, |
c3fc2621 | 174 | 'html' => [ |
e501603b | 175 | 'type' => 'Text', |
c3fc2621 CW |
176 | ], |
177 | ], | |
178 | 'rule_weight' => [ | |
e501603b TO |
179 | 'name' => 'rule_weight', |
180 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 181 | 'title' => ts('Order'), |
215b423e | 182 | 'description' => ts('The weight of the rule'), |
c3fc2621 | 183 | 'required' => TRUE, |
a36434b9 | 184 | 'where' => 'civicrm_dedupe_rule.rule_weight', |
522a26c9 | 185 | 'table_name' => 'civicrm_dedupe_rule', |
186 | 'entity' => 'Rule', | |
187 | 'bao' => 'CRM_Dedupe_BAO_Rule', | |
6a7e5e5d | 188 | 'localizable' => 0, |
c3fc2621 | 189 | 'html' => [ |
e501603b | 190 | 'type' => 'Text', |
c3fc2621 CW |
191 | ], |
192 | ], | |
193 | ]; | |
346aaaba | 194 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 195 | } |
346aaaba | 196 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 197 | } |
c3fc2621 | 198 | |
e501603b | 199 | /** |
bd8e0b14 | 200 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
201 | * |
202 | * @return array | |
bd8e0b14 | 203 | * Array(string $name => string $uniqueName). |
e501603b | 204 | */ |
c3fc2621 | 205 | public static function &fieldKeys() { |
bd8e0b14 TO |
206 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
207 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 208 | } |
bd8e0b14 | 209 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 210 | } |
c3fc2621 | 211 | |
e501603b TO |
212 | /** |
213 | * Returns the names of this table | |
214 | * | |
215 | * @return string | |
216 | */ | |
c3fc2621 | 217 | public static function getTableName() { |
e501603b TO |
218 | return self::$_tableName; |
219 | } | |
c3fc2621 | 220 | |
e501603b TO |
221 | /** |
222 | * Returns if this table needs to be logged | |
223 | * | |
c3fc2621 | 224 | * @return bool |
e501603b | 225 | */ |
c3fc2621 | 226 | public function getLog() { |
e501603b TO |
227 | return self::$_log; |
228 | } | |
c3fc2621 | 229 | |
e501603b TO |
230 | /** |
231 | * Returns the list of fields that can be imported | |
232 | * | |
233 | * @param bool $prefix | |
234 | * | |
235 | * @return array | |
236 | */ | |
c3fc2621 CW |
237 | public static function &import($prefix = FALSE) { |
238 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule', $prefix, []); | |
60808919 | 239 | return $r; |
e501603b | 240 | } |
c3fc2621 | 241 | |
e501603b TO |
242 | /** |
243 | * Returns the list of fields that can be exported | |
244 | * | |
245 | * @param bool $prefix | |
246 | * | |
247 | * @return array | |
248 | */ | |
c3fc2621 CW |
249 | public static function &export($prefix = FALSE) { |
250 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule', $prefix, []); | |
60808919 | 251 | return $r; |
e501603b | 252 | } |
c3fc2621 | 253 | |
e7a6b91a AS |
254 | /** |
255 | * Returns the list of indices | |
c3fc2621 CW |
256 | * |
257 | * @param bool $localize | |
258 | * | |
259 | * @return array | |
e7a6b91a AS |
260 | */ |
261 | public static function indices($localize = TRUE) { | |
c3fc2621 | 262 | $indices = []; |
e7a6b91a AS |
263 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
264 | } | |
c3fc2621 | 265 | |
e501603b | 266 | } |