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