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