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