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 | |
449c4e6b | 9 | * (GenCodeChecksum:77493b98b740fced03c2bca0ab28f567) |
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, |
c3fc2621 CW |
114 | ], |
115 | 'contact_type' => [ | |
e501603b TO |
116 | 'name' => 'contact_type', |
117 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 118 | 'title' => ts('Contact Type'), |
215b423e | 119 | 'description' => ts('The type of contacts this group applies to'), |
e501603b TO |
120 | 'maxlength' => 12, |
121 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 122 | 'where' => 'civicrm_dedupe_rule_group.contact_type', |
522a26c9 | 123 | 'table_name' => 'civicrm_dedupe_rule_group', |
124 | 'entity' => 'RuleGroup', | |
125 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 126 | 'localizable' => 0, |
c3fc2621 | 127 | 'html' => [ |
e501603b | 128 | 'type' => 'Select', |
c3fc2621 CW |
129 | ], |
130 | 'pseudoconstant' => [ | |
e501603b TO |
131 | 'table' => 'civicrm_contact_type', |
132 | 'keyColumn' => 'name', | |
133 | 'labelColumn' => 'label', | |
134 | 'condition' => 'parent_id IS NULL', | |
e6ca0a57 | 135 | ], |
c3fc2621 CW |
136 | ], |
137 | 'threshold' => [ | |
e501603b TO |
138 | 'name' => 'threshold', |
139 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 140 | 'title' => ts('Threshold'), |
215b423e | 141 | 'description' => ts('The weight threshold the sum of the rule weights has to cross to consider two contacts the same'), |
c3fc2621 | 142 | 'required' => TRUE, |
a36434b9 | 143 | 'where' => 'civicrm_dedupe_rule_group.threshold', |
522a26c9 | 144 | 'table_name' => 'civicrm_dedupe_rule_group', |
145 | 'entity' => 'RuleGroup', | |
146 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 147 | 'localizable' => 0, |
c3fc2621 | 148 | 'html' => [ |
e501603b | 149 | 'type' => 'Text', |
c3fc2621 CW |
150 | ], |
151 | ], | |
152 | 'used' => [ | |
e501603b TO |
153 | 'name' => 'used', |
154 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 155 | 'title' => ts('Length'), |
215b423e | 156 | 'description' => ts('Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically)'), |
c3fc2621 | 157 | 'required' => TRUE, |
e501603b TO |
158 | 'maxlength' => 12, |
159 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 160 | 'where' => 'civicrm_dedupe_rule_group.used', |
522a26c9 | 161 | 'table_name' => 'civicrm_dedupe_rule_group', |
162 | 'entity' => 'RuleGroup', | |
163 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 164 | 'localizable' => 0, |
c3fc2621 | 165 | 'html' => [ |
e501603b | 166 | 'type' => 'Radio', |
c3fc2621 CW |
167 | ], |
168 | 'pseudoconstant' => [ | |
e501603b | 169 | 'callback' => 'CRM_Core_SelectValues::getDedupeRuleTypes', |
e6ca0a57 | 170 | ], |
c3fc2621 CW |
171 | ], |
172 | 'name' => [ | |
e501603b TO |
173 | 'name' => 'name', |
174 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 175 | 'title' => ts('Name'), |
215b423e | 176 | 'description' => ts('Name of the rule group'), |
e501603b TO |
177 | 'maxlength' => 64, |
178 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 179 | 'where' => 'civicrm_dedupe_rule_group.name', |
522a26c9 | 180 | 'table_name' => 'civicrm_dedupe_rule_group', |
181 | 'entity' => 'RuleGroup', | |
182 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 183 | 'localizable' => 0, |
c3fc2621 CW |
184 | ], |
185 | 'title' => [ | |
e501603b TO |
186 | 'name' => 'title', |
187 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 188 | 'title' => ts('Title'), |
215b423e | 189 | 'description' => ts('Label of the rule group'), |
e501603b TO |
190 | 'maxlength' => 255, |
191 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 192 | 'where' => 'civicrm_dedupe_rule_group.title', |
522a26c9 | 193 | 'table_name' => 'civicrm_dedupe_rule_group', |
194 | 'entity' => 'RuleGroup', | |
195 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 196 | 'localizable' => 0, |
c3fc2621 | 197 | 'html' => [ |
e501603b | 198 | 'type' => 'Text', |
c3fc2621 CW |
199 | ], |
200 | ], | |
201 | 'is_reserved' => [ | |
e501603b TO |
202 | 'name' => 'is_reserved', |
203 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 204 | 'title' => ts('Reserved?'), |
215b423e | 205 | 'description' => ts('Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin'), |
a36434b9 | 206 | 'where' => 'civicrm_dedupe_rule_group.is_reserved', |
522a26c9 | 207 | 'table_name' => 'civicrm_dedupe_rule_group', |
208 | 'entity' => 'RuleGroup', | |
209 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', | |
6a7e5e5d | 210 | 'localizable' => 0, |
c3fc2621 | 211 | 'html' => [ |
e501603b | 212 | 'type' => 'CheckBox', |
c3fc2621 CW |
213 | ], |
214 | ], | |
215 | ]; | |
346aaaba | 216 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 217 | } |
346aaaba | 218 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 219 | } |
c3fc2621 | 220 | |
e501603b | 221 | /** |
bd8e0b14 | 222 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
223 | * |
224 | * @return array | |
bd8e0b14 | 225 | * Array(string $name => string $uniqueName). |
e501603b | 226 | */ |
c3fc2621 | 227 | public static function &fieldKeys() { |
bd8e0b14 TO |
228 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
229 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 230 | } |
bd8e0b14 | 231 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 232 | } |
c3fc2621 | 233 | |
e501603b TO |
234 | /** |
235 | * Returns the names of this table | |
236 | * | |
237 | * @return string | |
238 | */ | |
c3fc2621 | 239 | public static function getTableName() { |
e501603b TO |
240 | return self::$_tableName; |
241 | } | |
c3fc2621 | 242 | |
e501603b TO |
243 | /** |
244 | * Returns if this table needs to be logged | |
245 | * | |
c3fc2621 | 246 | * @return bool |
e501603b | 247 | */ |
c3fc2621 | 248 | public function getLog() { |
e501603b TO |
249 | return self::$_log; |
250 | } | |
c3fc2621 | 251 | |
e501603b TO |
252 | /** |
253 | * Returns the list of fields that can be imported | |
254 | * | |
255 | * @param bool $prefix | |
256 | * | |
257 | * @return array | |
258 | */ | |
c3fc2621 CW |
259 | public static function &import($prefix = FALSE) { |
260 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule_group', $prefix, []); | |
60808919 | 261 | return $r; |
e501603b | 262 | } |
c3fc2621 | 263 | |
e501603b TO |
264 | /** |
265 | * Returns the list of fields that can be exported | |
266 | * | |
267 | * @param bool $prefix | |
268 | * | |
269 | * @return array | |
270 | */ | |
c3fc2621 CW |
271 | public static function &export($prefix = FALSE) { |
272 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule_group', $prefix, []); | |
60808919 | 273 | return $r; |
e501603b | 274 | } |
c3fc2621 | 275 | |
e7a6b91a AS |
276 | /** |
277 | * Returns the list of indices | |
c3fc2621 CW |
278 | * |
279 | * @param bool $localize | |
280 | * | |
281 | * @return array | |
e7a6b91a AS |
282 | */ |
283 | public static function indices($localize = TRUE) { | |
c3fc2621 | 284 | $indices = []; |
e7a6b91a AS |
285 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
286 | } | |
c3fc2621 | 287 | |
e501603b | 288 | } |