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