Commit | Line | Data |
---|---|---|
bb4187d7 MD |
1 | <?php |
2 | ||
3 | /** | |
4 | * @package CRM | |
5 | * @copyright CiviCRM LLC https://civicrm.org/licensing | |
6 | * | |
7 | * Generated from xml/schema/CRM/Dedupe/DedupeRuleGroup.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
c1e814c7 | 9 | * (GenCodeChecksum:9390f709bdbf2945acb57c353814e393) |
bb4187d7 MD |
10 | */ |
11 | ||
12 | /** | |
13 | * Database access object for the DedupeRuleGroup entity. | |
14 | */ | |
15 | class CRM_Dedupe_DAO_DedupeRuleGroup extends CRM_Core_DAO { | |
16 | const EXT = 'civicrm'; | |
17 | const TABLE_ADDED = '1.8'; | |
18 | ||
19 | /** | |
20 | * Static instance to hold the table name. | |
21 | * | |
22 | * @var string | |
23 | */ | |
24 | public static $_tableName = 'civicrm_dedupe_rule_group'; | |
25 | ||
26 | /** | |
27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. | |
28 | * | |
29 | * @var bool | |
30 | */ | |
31 | public static $_log = FALSE; | |
32 | ||
33 | /** | |
34 | * Unique dedupe rule group id | |
35 | * | |
28979d65 CW |
36 | * @var int|string|null |
37 | * (SQL type: int unsigned) | |
38 | * Note that values will be retrieved from the database as a string. | |
bb4187d7 MD |
39 | */ |
40 | public $id; | |
41 | ||
42 | /** | |
43 | * The type of contacts this group applies to | |
44 | * | |
28979d65 CW |
45 | * @var string|null |
46 | * (SQL type: varchar(12)) | |
47 | * Note that values will be retrieved from the database as a string. | |
bb4187d7 MD |
48 | */ |
49 | public $contact_type; | |
50 | ||
51 | /** | |
52 | * The weight threshold the sum of the rule weights has to cross to consider two contacts the same | |
53 | * | |
28979d65 CW |
54 | * @var int|string |
55 | * (SQL type: int) | |
56 | * Note that values will be retrieved from the database as a string. | |
bb4187d7 MD |
57 | */ |
58 | public $threshold; | |
59 | ||
60 | /** | |
61 | * Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically) | |
62 | * | |
63 | * @var string | |
28979d65 CW |
64 | * (SQL type: varchar(12)) |
65 | * Note that values will be retrieved from the database as a string. | |
bb4187d7 MD |
66 | */ |
67 | public $used; | |
68 | ||
69 | /** | |
70 | * Name of the rule group | |
71 | * | |
28979d65 CW |
72 | * @var string|null |
73 | * (SQL type: varchar(64)) | |
74 | * Note that values will be retrieved from the database as a string. | |
bb4187d7 MD |
75 | */ |
76 | public $name; | |
77 | ||
78 | /** | |
79 | * Label of the rule group | |
80 | * | |
28979d65 CW |
81 | * @var string|null |
82 | * (SQL type: varchar(255)) | |
83 | * Note that values will be retrieved from the database as a string. | |
bb4187d7 MD |
84 | */ |
85 | public $title; | |
86 | ||
87 | /** | |
88 | * Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin | |
89 | * | |
c1e814c7 | 90 | * @var bool|string |
28979d65 CW |
91 | * (SQL type: tinyint) |
92 | * Note that values will be retrieved from the database as a string. | |
bb4187d7 MD |
93 | */ |
94 | public $is_reserved; | |
95 | ||
96 | /** | |
97 | * Class constructor. | |
98 | */ | |
99 | public function __construct() { | |
100 | $this->__table = 'civicrm_dedupe_rule_group'; | |
101 | parent::__construct(); | |
102 | } | |
103 | ||
104 | /** | |
105 | * Returns localized title of this entity. | |
106 | * | |
107 | * @param bool $plural | |
108 | * Whether to return the plural version of the title. | |
109 | */ | |
110 | public static function getEntityTitle($plural = FALSE) { | |
111 | return $plural ? ts('Dedupe Rule Groups') : ts('Dedupe Rule Group'); | |
112 | } | |
113 | ||
114 | /** | |
115 | * Returns all the column names of this table | |
116 | * | |
117 | * @return array | |
118 | */ | |
119 | public static function &fields() { | |
120 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { | |
121 | Civi::$statics[__CLASS__]['fields'] = [ | |
122 | 'id' => [ | |
123 | 'name' => 'id', | |
124 | 'type' => CRM_Utils_Type::T_INT, | |
125 | 'title' => ts('Rule Group ID'), | |
126 | 'description' => ts('Unique dedupe rule group id'), | |
127 | 'required' => TRUE, | |
128 | 'where' => 'civicrm_dedupe_rule_group.id', | |
129 | 'table_name' => 'civicrm_dedupe_rule_group', | |
130 | 'entity' => 'DedupeRuleGroup', | |
131 | 'bao' => 'CRM_Dedupe_BAO_DedupeRuleGroup', | |
132 | 'localizable' => 0, | |
133 | 'html' => [ | |
134 | 'type' => 'Number', | |
135 | ], | |
136 | 'readonly' => TRUE, | |
137 | 'add' => '1.8', | |
138 | ], | |
139 | 'contact_type' => [ | |
140 | 'name' => 'contact_type', | |
141 | 'type' => CRM_Utils_Type::T_STRING, | |
142 | 'title' => ts('Contact Type'), | |
143 | 'description' => ts('The type of contacts this group applies to'), | |
144 | 'maxlength' => 12, | |
145 | 'size' => CRM_Utils_Type::TWELVE, | |
146 | 'where' => 'civicrm_dedupe_rule_group.contact_type', | |
147 | 'table_name' => 'civicrm_dedupe_rule_group', | |
148 | 'entity' => 'DedupeRuleGroup', | |
149 | 'bao' => 'CRM_Dedupe_BAO_DedupeRuleGroup', | |
150 | 'localizable' => 0, | |
151 | 'html' => [ | |
152 | 'type' => 'Select', | |
153 | ], | |
154 | 'pseudoconstant' => [ | |
155 | 'table' => 'civicrm_contact_type', | |
156 | 'keyColumn' => 'name', | |
157 | 'labelColumn' => 'label', | |
158 | 'condition' => 'parent_id IS NULL', | |
159 | ], | |
160 | 'add' => '1.8', | |
161 | ], | |
162 | 'threshold' => [ | |
163 | 'name' => 'threshold', | |
164 | 'type' => CRM_Utils_Type::T_INT, | |
165 | 'title' => ts('Threshold'), | |
166 | 'description' => ts('The weight threshold the sum of the rule weights has to cross to consider two contacts the same'), | |
167 | 'required' => TRUE, | |
168 | 'where' => 'civicrm_dedupe_rule_group.threshold', | |
169 | 'table_name' => 'civicrm_dedupe_rule_group', | |
170 | 'entity' => 'DedupeRuleGroup', | |
171 | 'bao' => 'CRM_Dedupe_BAO_DedupeRuleGroup', | |
172 | 'localizable' => 0, | |
173 | 'html' => [ | |
174 | 'type' => 'Text', | |
175 | ], | |
176 | 'add' => '1.8', | |
177 | ], | |
178 | 'used' => [ | |
179 | 'name' => 'used', | |
180 | 'type' => CRM_Utils_Type::T_STRING, | |
181 | 'title' => ts('Length'), | |
182 | 'description' => ts('Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically)'), | |
183 | 'required' => TRUE, | |
184 | 'maxlength' => 12, | |
185 | 'size' => CRM_Utils_Type::TWELVE, | |
186 | 'where' => 'civicrm_dedupe_rule_group.used', | |
187 | 'table_name' => 'civicrm_dedupe_rule_group', | |
188 | 'entity' => 'DedupeRuleGroup', | |
189 | 'bao' => 'CRM_Dedupe_BAO_DedupeRuleGroup', | |
190 | 'localizable' => 0, | |
191 | 'html' => [ | |
192 | 'type' => 'Radio', | |
193 | ], | |
194 | 'pseudoconstant' => [ | |
195 | 'callback' => 'CRM_Core_SelectValues::getDedupeRuleTypes', | |
196 | ], | |
197 | 'add' => '4.3', | |
198 | ], | |
199 | 'name' => [ | |
200 | 'name' => 'name', | |
201 | 'type' => CRM_Utils_Type::T_STRING, | |
202 | 'title' => ts('Name'), | |
203 | 'description' => ts('Name of the rule group'), | |
204 | 'maxlength' => 64, | |
205 | 'size' => CRM_Utils_Type::BIG, | |
206 | 'where' => 'civicrm_dedupe_rule_group.name', | |
207 | 'table_name' => 'civicrm_dedupe_rule_group', | |
208 | 'entity' => 'DedupeRuleGroup', | |
209 | 'bao' => 'CRM_Dedupe_BAO_DedupeRuleGroup', | |
210 | 'localizable' => 0, | |
211 | 'add' => '2.1', | |
212 | ], | |
213 | 'title' => [ | |
214 | 'name' => 'title', | |
215 | 'type' => CRM_Utils_Type::T_STRING, | |
216 | 'title' => ts('Title'), | |
217 | 'description' => ts('Label of the rule group'), | |
218 | 'maxlength' => 255, | |
219 | 'size' => CRM_Utils_Type::HUGE, | |
220 | 'where' => 'civicrm_dedupe_rule_group.title', | |
221 | 'table_name' => 'civicrm_dedupe_rule_group', | |
222 | 'entity' => 'DedupeRuleGroup', | |
223 | 'bao' => 'CRM_Dedupe_BAO_DedupeRuleGroup', | |
224 | 'localizable' => 0, | |
225 | 'html' => [ | |
226 | 'type' => 'Text', | |
227 | ], | |
228 | 'add' => '4.1', | |
229 | ], | |
230 | 'is_reserved' => [ | |
231 | 'name' => 'is_reserved', | |
232 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
233 | 'title' => ts('Reserved?'), | |
234 | 'description' => ts('Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin'), | |
c1e814c7 | 235 | 'required' => TRUE, |
bb4187d7 | 236 | 'where' => 'civicrm_dedupe_rule_group.is_reserved', |
c1e814c7 | 237 | 'default' => '0', |
bb4187d7 MD |
238 | 'table_name' => 'civicrm_dedupe_rule_group', |
239 | 'entity' => 'DedupeRuleGroup', | |
240 | 'bao' => 'CRM_Dedupe_BAO_DedupeRuleGroup', | |
241 | 'localizable' => 0, | |
242 | 'html' => [ | |
243 | 'type' => 'CheckBox', | |
244 | ], | |
245 | 'add' => '4.1', | |
246 | ], | |
247 | ]; | |
248 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); | |
249 | } | |
250 | return Civi::$statics[__CLASS__]['fields']; | |
251 | } | |
252 | ||
253 | /** | |
254 | * Return a mapping from field-name to the corresponding key (as used in fields()). | |
255 | * | |
256 | * @return array | |
257 | * Array(string $name => string $uniqueName). | |
258 | */ | |
259 | public static function &fieldKeys() { | |
260 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { | |
261 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
262 | } | |
263 | return Civi::$statics[__CLASS__]['fieldKeys']; | |
264 | } | |
265 | ||
266 | /** | |
267 | * Returns the names of this table | |
268 | * | |
269 | * @return string | |
270 | */ | |
271 | public static function getTableName() { | |
272 | return self::$_tableName; | |
273 | } | |
274 | ||
275 | /** | |
276 | * Returns if this table needs to be logged | |
277 | * | |
278 | * @return bool | |
279 | */ | |
280 | public function getLog() { | |
281 | return self::$_log; | |
282 | } | |
283 | ||
284 | /** | |
285 | * Returns the list of fields that can be imported | |
286 | * | |
287 | * @param bool $prefix | |
288 | * | |
289 | * @return array | |
290 | */ | |
291 | public static function &import($prefix = FALSE) { | |
292 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule_group', $prefix, []); | |
293 | return $r; | |
294 | } | |
295 | ||
296 | /** | |
297 | * Returns the list of fields that can be exported | |
298 | * | |
299 | * @param bool $prefix | |
300 | * | |
301 | * @return array | |
302 | */ | |
303 | public static function &export($prefix = FALSE) { | |
304 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule_group', $prefix, []); | |
305 | return $r; | |
306 | } | |
307 | ||
308 | /** | |
309 | * Returns the list of indices | |
310 | * | |
311 | * @param bool $localize | |
312 | * | |
313 | * @return array | |
314 | */ | |
315 | public static function indices($localize = TRUE) { | |
316 | $indices = []; | |
317 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; | |
318 | } | |
319 | ||
320 | } |