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