Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Dedupe/Rule.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e6ca0a57 | 9 | * (GenCodeChecksum:a7697e9d93641b3240e23f97f4f92329) |
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 | |
e501603b | 81 | /** |
f41f0342 | 82 | * Returns foreign keys and entity references. |
e501603b TO |
83 | * |
84 | * @return array | |
85 | * [CRM_Core_Reference_Interface] | |
86 | */ | |
c3fc2621 | 87 | public static function getReferenceColumns() { |
346aaaba | 88 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 89 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 90 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id'); |
346aaaba | 91 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 92 | } |
346aaaba | 93 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 94 | } |
c3fc2621 | 95 | |
e501603b TO |
96 | /** |
97 | * Returns all the column names of this table | |
98 | * | |
99 | * @return array | |
100 | */ | |
c3fc2621 | 101 | public static function &fields() { |
346aaaba | 102 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
103 | Civi::$statics[__CLASS__]['fields'] = [ |
104 | 'id' => [ | |
e501603b TO |
105 | 'name' => 'id', |
106 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 107 | 'title' => ts('Dedupe Rule ID'), |
215b423e | 108 | 'description' => ts('Unique dedupe rule id'), |
c3fc2621 | 109 | 'required' => TRUE, |
a36434b9 | 110 | 'where' => 'civicrm_dedupe_rule.id', |
522a26c9 | 111 | 'table_name' => 'civicrm_dedupe_rule', |
112 | 'entity' => 'Rule', | |
113 | 'bao' => 'CRM_Dedupe_BAO_Rule', | |
6a7e5e5d | 114 | 'localizable' => 0, |
c3fc2621 CW |
115 | ], |
116 | 'dedupe_rule_group_id' => [ | |
e501603b TO |
117 | 'name' => 'dedupe_rule_group_id', |
118 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 119 | 'title' => ts('Dedupe Rule Group'), |
215b423e | 120 | 'description' => ts('The id of the rule group this rule belongs to'), |
c3fc2621 | 121 | 'required' => TRUE, |
a36434b9 | 122 | 'where' => 'civicrm_dedupe_rule.dedupe_rule_group_id', |
522a26c9 | 123 | 'table_name' => 'civicrm_dedupe_rule', |
124 | 'entity' => 'Rule', | |
125 | 'bao' => 'CRM_Dedupe_BAO_Rule', | |
6a7e5e5d | 126 | 'localizable' => 0, |
e501603b | 127 | 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup', |
c3fc2621 CW |
128 | ], |
129 | 'rule_table' => [ | |
e501603b TO |
130 | 'name' => 'rule_table', |
131 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 132 | 'title' => ts('Rule Table'), |
215b423e | 133 | 'description' => ts('The name of the table this rule is about'), |
c3fc2621 | 134 | 'required' => TRUE, |
e501603b TO |
135 | 'maxlength' => 64, |
136 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 137 | 'where' => 'civicrm_dedupe_rule.rule_table', |
522a26c9 | 138 | 'table_name' => 'civicrm_dedupe_rule', |
139 | 'entity' => 'Rule', | |
140 | 'bao' => 'CRM_Dedupe_BAO_Rule', | |
6a7e5e5d | 141 | 'localizable' => 0, |
c3fc2621 CW |
142 | ], |
143 | 'rule_field' => [ | |
e501603b TO |
144 | 'name' => 'rule_field', |
145 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 146 | 'title' => ts('Rule Field'), |
215b423e | 147 | 'description' => ts('The name of the field of the table referenced in rule_table'), |
c3fc2621 | 148 | 'required' => TRUE, |
e501603b TO |
149 | 'maxlength' => 64, |
150 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 151 | 'where' => 'civicrm_dedupe_rule.rule_field', |
522a26c9 | 152 | 'table_name' => 'civicrm_dedupe_rule', |
153 | 'entity' => 'Rule', | |
154 | 'bao' => 'CRM_Dedupe_BAO_Rule', | |
6a7e5e5d | 155 | 'localizable' => 0, |
c3fc2621 CW |
156 | ], |
157 | 'rule_length' => [ | |
e501603b TO |
158 | 'name' => 'rule_length', |
159 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 160 | 'title' => ts('Rule Length'), |
215b423e | 161 | 'description' => ts('The length of the matching substring'), |
a36434b9 | 162 | 'where' => 'civicrm_dedupe_rule.rule_length', |
522a26c9 | 163 | 'table_name' => 'civicrm_dedupe_rule', |
164 | 'entity' => 'Rule', | |
165 | 'bao' => 'CRM_Dedupe_BAO_Rule', | |
6a7e5e5d | 166 | 'localizable' => 0, |
c3fc2621 | 167 | 'html' => [ |
e501603b | 168 | 'type' => 'Text', |
c3fc2621 CW |
169 | ], |
170 | ], | |
171 | 'rule_weight' => [ | |
e501603b TO |
172 | 'name' => 'rule_weight', |
173 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 174 | 'title' => ts('Order'), |
215b423e | 175 | 'description' => ts('The weight of the rule'), |
c3fc2621 | 176 | 'required' => TRUE, |
a36434b9 | 177 | 'where' => 'civicrm_dedupe_rule.rule_weight', |
522a26c9 | 178 | 'table_name' => 'civicrm_dedupe_rule', |
179 | 'entity' => 'Rule', | |
180 | 'bao' => 'CRM_Dedupe_BAO_Rule', | |
6a7e5e5d | 181 | 'localizable' => 0, |
c3fc2621 | 182 | 'html' => [ |
e501603b | 183 | 'type' => 'Text', |
c3fc2621 CW |
184 | ], |
185 | ], | |
186 | ]; | |
346aaaba | 187 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 188 | } |
346aaaba | 189 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 190 | } |
c3fc2621 | 191 | |
e501603b | 192 | /** |
bd8e0b14 | 193 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
194 | * |
195 | * @return array | |
bd8e0b14 | 196 | * Array(string $name => string $uniqueName). |
e501603b | 197 | */ |
c3fc2621 | 198 | public static function &fieldKeys() { |
bd8e0b14 TO |
199 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
200 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 201 | } |
bd8e0b14 | 202 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 203 | } |
c3fc2621 | 204 | |
e501603b TO |
205 | /** |
206 | * Returns the names of this table | |
207 | * | |
208 | * @return string | |
209 | */ | |
c3fc2621 | 210 | public static function getTableName() { |
e501603b TO |
211 | return self::$_tableName; |
212 | } | |
c3fc2621 | 213 | |
e501603b TO |
214 | /** |
215 | * Returns if this table needs to be logged | |
216 | * | |
c3fc2621 | 217 | * @return bool |
e501603b | 218 | */ |
c3fc2621 | 219 | public function getLog() { |
e501603b TO |
220 | return self::$_log; |
221 | } | |
c3fc2621 | 222 | |
e501603b TO |
223 | /** |
224 | * Returns the list of fields that can be imported | |
225 | * | |
226 | * @param bool $prefix | |
227 | * | |
228 | * @return array | |
229 | */ | |
c3fc2621 CW |
230 | public static function &import($prefix = FALSE) { |
231 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule', $prefix, []); | |
60808919 | 232 | return $r; |
e501603b | 233 | } |
c3fc2621 | 234 | |
e501603b TO |
235 | /** |
236 | * Returns the list of fields that can be exported | |
237 | * | |
238 | * @param bool $prefix | |
239 | * | |
240 | * @return array | |
241 | */ | |
c3fc2621 CW |
242 | public static function &export($prefix = FALSE) { |
243 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule', $prefix, []); | |
60808919 | 244 | return $r; |
e501603b | 245 | } |
c3fc2621 | 246 | |
e7a6b91a AS |
247 | /** |
248 | * Returns the list of indices | |
c3fc2621 CW |
249 | * |
250 | * @param bool $localize | |
251 | * | |
252 | * @return array | |
e7a6b91a AS |
253 | */ |
254 | public static function indices($localize = TRUE) { | |
c3fc2621 | 255 | $indices = []; |
e7a6b91a AS |
256 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
257 | } | |
c3fc2621 | 258 | |
e501603b | 259 | } |