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