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/RuleGroup.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
a9d0587b | 9 | * (GenCodeChecksum:3c21b8b33d8d561b1104318fba0db930) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the RuleGroup entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Dedupe_DAO_RuleGroup 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_group'; |
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 group id | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * The type of contacts this group applies to | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | public $contact_type; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * The weight threshold the sum of the rule weights has to cross to consider two contacts the same | |
47 | * | |
48 | * @var int | |
49 | */ | |
50 | public $threshold; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically) | |
54 | * | |
55 | * @var string | |
56 | */ | |
57 | public $used; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Name of the rule group | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $name; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Label of the rule group | |
68 | * | |
69 | * @var string | |
70 | */ | |
71 | public $title; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin | |
75 | * | |
e6ca0a57 | 76 | * @var bool |
e501603b TO |
77 | */ |
78 | public $is_reserved; | |
c3fc2621 | 79 | |
e501603b | 80 | /** |
f41f0342 | 81 | * Class constructor. |
e501603b | 82 | */ |
c3fc2621 | 83 | public function __construct() { |
e501603b TO |
84 | $this->__table = 'civicrm_dedupe_rule_group'; |
85 | parent::__construct(); | |
86 | } | |
c3fc2621 | 87 | |
449c4e6b CW |
88 | /** |
89 | * Returns localized title of this entity. | |
90 | */ | |
91 | public static function getEntityTitle() { | |
92 | return ts('Rule Groups'); | |
93 | } | |
94 | ||
e501603b TO |
95 | /** |
96 | * Returns all the column names of this table | |
97 | * | |
98 | * @return array | |
99 | */ | |
c3fc2621 | 100 | public static function &fields() { |
346aaaba | 101 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
102 | Civi::$statics[__CLASS__]['fields'] = [ |
103 | 'id' => [ | |
e501603b TO |
104 | 'name' => 'id', |
105 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 106 | 'title' => ts('Rule Group ID'), |
215b423e | 107 | 'description' => ts('Unique dedupe rule group id'), |
c3fc2621 | 108 | 'required' => TRUE, |
a36434b9 | 109 | 'where' => 'civicrm_dedupe_rule_group.id', |
522a26c9 | 110 | 'table_name' => 'civicrm_dedupe_rule_group', |
111 | 'entity' => 'RuleGroup', | |
112 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 113 | 'localizable' => 0, |
a9d0587b | 114 | 'add' => '1.8', |
c3fc2621 CW |
115 | ], |
116 | 'contact_type' => [ | |
e501603b TO |
117 | 'name' => 'contact_type', |
118 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 119 | 'title' => ts('Contact Type'), |
215b423e | 120 | 'description' => ts('The type of contacts this group applies to'), |
e501603b TO |
121 | 'maxlength' => 12, |
122 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 123 | 'where' => 'civicrm_dedupe_rule_group.contact_type', |
522a26c9 | 124 | 'table_name' => 'civicrm_dedupe_rule_group', |
125 | 'entity' => 'RuleGroup', | |
126 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 127 | 'localizable' => 0, |
c3fc2621 | 128 | 'html' => [ |
e501603b | 129 | 'type' => 'Select', |
c3fc2621 CW |
130 | ], |
131 | 'pseudoconstant' => [ | |
e501603b TO |
132 | 'table' => 'civicrm_contact_type', |
133 | 'keyColumn' => 'name', | |
134 | 'labelColumn' => 'label', | |
135 | 'condition' => 'parent_id IS NULL', | |
e6ca0a57 | 136 | ], |
a9d0587b | 137 | 'add' => '1.8', |
c3fc2621 CW |
138 | ], |
139 | 'threshold' => [ | |
e501603b TO |
140 | 'name' => 'threshold', |
141 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 142 | 'title' => ts('Threshold'), |
215b423e | 143 | 'description' => ts('The weight threshold the sum of the rule weights has to cross to consider two contacts the same'), |
c3fc2621 | 144 | 'required' => TRUE, |
a36434b9 | 145 | 'where' => 'civicrm_dedupe_rule_group.threshold', |
522a26c9 | 146 | 'table_name' => 'civicrm_dedupe_rule_group', |
147 | 'entity' => 'RuleGroup', | |
148 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 149 | 'localizable' => 0, |
c3fc2621 | 150 | 'html' => [ |
e501603b | 151 | 'type' => 'Text', |
c3fc2621 | 152 | ], |
a9d0587b | 153 | 'add' => '1.8', |
c3fc2621 CW |
154 | ], |
155 | 'used' => [ | |
e501603b TO |
156 | 'name' => 'used', |
157 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 158 | 'title' => ts('Length'), |
215b423e | 159 | 'description' => ts('Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically)'), |
c3fc2621 | 160 | 'required' => TRUE, |
e501603b TO |
161 | 'maxlength' => 12, |
162 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 163 | 'where' => 'civicrm_dedupe_rule_group.used', |
522a26c9 | 164 | 'table_name' => 'civicrm_dedupe_rule_group', |
165 | 'entity' => 'RuleGroup', | |
166 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 167 | 'localizable' => 0, |
c3fc2621 | 168 | 'html' => [ |
e501603b | 169 | 'type' => 'Radio', |
c3fc2621 CW |
170 | ], |
171 | 'pseudoconstant' => [ | |
e501603b | 172 | 'callback' => 'CRM_Core_SelectValues::getDedupeRuleTypes', |
e6ca0a57 | 173 | ], |
a9d0587b | 174 | 'add' => '4.3', |
c3fc2621 CW |
175 | ], |
176 | 'name' => [ | |
e501603b TO |
177 | 'name' => 'name', |
178 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 179 | 'title' => ts('Name'), |
215b423e | 180 | 'description' => ts('Name of the rule group'), |
e501603b TO |
181 | 'maxlength' => 64, |
182 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 183 | 'where' => 'civicrm_dedupe_rule_group.name', |
522a26c9 | 184 | 'table_name' => 'civicrm_dedupe_rule_group', |
185 | 'entity' => 'RuleGroup', | |
186 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 187 | 'localizable' => 0, |
a9d0587b | 188 | 'add' => '2.1', |
c3fc2621 CW |
189 | ], |
190 | 'title' => [ | |
e501603b TO |
191 | 'name' => 'title', |
192 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 193 | 'title' => ts('Title'), |
215b423e | 194 | 'description' => ts('Label of the rule group'), |
e501603b TO |
195 | 'maxlength' => 255, |
196 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 197 | 'where' => 'civicrm_dedupe_rule_group.title', |
522a26c9 | 198 | 'table_name' => 'civicrm_dedupe_rule_group', |
199 | 'entity' => 'RuleGroup', | |
200 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 201 | 'localizable' => 0, |
c3fc2621 | 202 | 'html' => [ |
e501603b | 203 | 'type' => 'Text', |
c3fc2621 | 204 | ], |
a9d0587b | 205 | 'add' => '4.1', |
c3fc2621 CW |
206 | ], |
207 | 'is_reserved' => [ | |
e501603b TO |
208 | 'name' => 'is_reserved', |
209 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 210 | 'title' => ts('Reserved?'), |
215b423e | 211 | 'description' => ts('Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin'), |
a36434b9 | 212 | 'where' => 'civicrm_dedupe_rule_group.is_reserved', |
522a26c9 | 213 | 'table_name' => 'civicrm_dedupe_rule_group', |
214 | 'entity' => 'RuleGroup', | |
215 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 216 | 'localizable' => 0, |
c3fc2621 | 217 | 'html' => [ |
e501603b | 218 | 'type' => 'CheckBox', |
c3fc2621 | 219 | ], |
a9d0587b | 220 | 'add' => '4.1', |
c3fc2621 CW |
221 | ], |
222 | ]; | |
346aaaba | 223 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 224 | } |
346aaaba | 225 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 226 | } |
c3fc2621 | 227 | |
e501603b | 228 | /** |
bd8e0b14 | 229 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
230 | * |
231 | * @return array | |
bd8e0b14 | 232 | * Array(string $name => string $uniqueName). |
e501603b | 233 | */ |
c3fc2621 | 234 | public static function &fieldKeys() { |
bd8e0b14 TO |
235 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
236 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 237 | } |
bd8e0b14 | 238 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 239 | } |
c3fc2621 | 240 | |
e501603b TO |
241 | /** |
242 | * Returns the names of this table | |
243 | * | |
244 | * @return string | |
245 | */ | |
c3fc2621 | 246 | public static function getTableName() { |
e501603b TO |
247 | return self::$_tableName; |
248 | } | |
c3fc2621 | 249 | |
e501603b TO |
250 | /** |
251 | * Returns if this table needs to be logged | |
252 | * | |
c3fc2621 | 253 | * @return bool |
e501603b | 254 | */ |
c3fc2621 | 255 | public function getLog() { |
e501603b TO |
256 | return self::$_log; |
257 | } | |
c3fc2621 | 258 | |
e501603b TO |
259 | /** |
260 | * Returns the list of fields that can be imported | |
261 | * | |
262 | * @param bool $prefix | |
263 | * | |
264 | * @return array | |
265 | */ | |
c3fc2621 CW |
266 | public static function &import($prefix = FALSE) { |
267 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule_group', $prefix, []); | |
60808919 | 268 | return $r; |
e501603b | 269 | } |
c3fc2621 | 270 | |
e501603b TO |
271 | /** |
272 | * Returns the list of fields that can be exported | |
273 | * | |
274 | * @param bool $prefix | |
275 | * | |
276 | * @return array | |
277 | */ | |
c3fc2621 CW |
278 | public static function &export($prefix = FALSE) { |
279 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule_group', $prefix, []); | |
60808919 | 280 | return $r; |
e501603b | 281 | } |
c3fc2621 | 282 | |
e7a6b91a AS |
283 | /** |
284 | * Returns the list of indices | |
c3fc2621 CW |
285 | * |
286 | * @param bool $localize | |
287 | * | |
288 | * @return array | |
e7a6b91a AS |
289 | */ |
290 | public static function indices($localize = TRUE) { | |
c3fc2621 | 291 | $indices = []; |
e7a6b91a AS |
292 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
293 | } | |
c3fc2621 | 294 | |
e501603b | 295 | } |