Merge pull request #19014 from eileenmcnaughton/cancel
[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:521bf67a7ab4ab491ff90780009e759f)
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 'add' => '1.8',
120 ],
121 'contact_type' => [
122 'name' => 'contact_type',
123 'type' => CRM_Utils_Type::T_STRING,
124 'title' => ts('Contact Type'),
125 'description' => ts('The type of contacts this group applies to'),
126 'maxlength' => 12,
127 'size' => CRM_Utils_Type::TWELVE,
128 'where' => 'civicrm_dedupe_rule_group.contact_type',
129 'table_name' => 'civicrm_dedupe_rule_group',
130 'entity' => 'RuleGroup',
131 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
132 'localizable' => 0,
133 'html' => [
134 'type' => 'Select',
135 ],
136 'pseudoconstant' => [
137 'table' => 'civicrm_contact_type',
138 'keyColumn' => 'name',
139 'labelColumn' => 'label',
140 'condition' => 'parent_id IS NULL',
141 ],
142 'add' => '1.8',
143 ],
144 'threshold' => [
145 'name' => 'threshold',
146 'type' => CRM_Utils_Type::T_INT,
147 'title' => ts('Threshold'),
148 'description' => ts('The weight threshold the sum of the rule weights has to cross to consider two contacts the same'),
149 'required' => TRUE,
150 'where' => 'civicrm_dedupe_rule_group.threshold',
151 'table_name' => 'civicrm_dedupe_rule_group',
152 'entity' => 'RuleGroup',
153 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
154 'localizable' => 0,
155 'html' => [
156 'type' => 'Text',
157 ],
158 'add' => '1.8',
159 ],
160 'used' => [
161 'name' => 'used',
162 'type' => CRM_Utils_Type::T_STRING,
163 'title' => ts('Length'),
164 'description' => ts('Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically)'),
165 'required' => TRUE,
166 'maxlength' => 12,
167 'size' => CRM_Utils_Type::TWELVE,
168 'where' => 'civicrm_dedupe_rule_group.used',
169 'table_name' => 'civicrm_dedupe_rule_group',
170 'entity' => 'RuleGroup',
171 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
172 'localizable' => 0,
173 'html' => [
174 'type' => 'Radio',
175 ],
176 'pseudoconstant' => [
177 'callback' => 'CRM_Core_SelectValues::getDedupeRuleTypes',
178 ],
179 'add' => '4.3',
180 ],
181 'name' => [
182 'name' => 'name',
183 'type' => CRM_Utils_Type::T_STRING,
184 'title' => ts('Name'),
185 'description' => ts('Name of the rule group'),
186 'maxlength' => 64,
187 'size' => CRM_Utils_Type::BIG,
188 'where' => 'civicrm_dedupe_rule_group.name',
189 'table_name' => 'civicrm_dedupe_rule_group',
190 'entity' => 'RuleGroup',
191 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
192 'localizable' => 0,
193 'add' => '2.1',
194 ],
195 'title' => [
196 'name' => 'title',
197 'type' => CRM_Utils_Type::T_STRING,
198 'title' => ts('Title'),
199 'description' => ts('Label of the rule group'),
200 'maxlength' => 255,
201 'size' => CRM_Utils_Type::HUGE,
202 'where' => 'civicrm_dedupe_rule_group.title',
203 'table_name' => 'civicrm_dedupe_rule_group',
204 'entity' => 'RuleGroup',
205 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
206 'localizable' => 0,
207 'html' => [
208 'type' => 'Text',
209 ],
210 'add' => '4.1',
211 ],
212 'is_reserved' => [
213 'name' => 'is_reserved',
214 'type' => CRM_Utils_Type::T_BOOLEAN,
215 'title' => ts('Reserved?'),
216 'description' => ts('Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin'),
217 'where' => 'civicrm_dedupe_rule_group.is_reserved',
218 'table_name' => 'civicrm_dedupe_rule_group',
219 'entity' => 'RuleGroup',
220 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
221 'localizable' => 0,
222 'html' => [
223 'type' => 'CheckBox',
224 ],
225 'add' => '4.1',
226 ],
227 ];
228 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
229 }
230 return Civi::$statics[__CLASS__]['fields'];
231 }
232
233 /**
234 * Return a mapping from field-name to the corresponding key (as used in fields()).
235 *
236 * @return array
237 * Array(string $name => string $uniqueName).
238 */
239 public static function &fieldKeys() {
240 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
241 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
242 }
243 return Civi::$statics[__CLASS__]['fieldKeys'];
244 }
245
246 /**
247 * Returns the names of this table
248 *
249 * @return string
250 */
251 public static function getTableName() {
252 return self::$_tableName;
253 }
254
255 /**
256 * Returns if this table needs to be logged
257 *
258 * @return bool
259 */
260 public function getLog() {
261 return self::$_log;
262 }
263
264 /**
265 * Returns the list of fields that can be imported
266 *
267 * @param bool $prefix
268 *
269 * @return array
270 */
271 public static function &import($prefix = FALSE) {
272 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule_group', $prefix, []);
273 return $r;
274 }
275
276 /**
277 * Returns the list of fields that can be exported
278 *
279 * @param bool $prefix
280 *
281 * @return array
282 */
283 public static function &export($prefix = FALSE) {
284 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule_group', $prefix, []);
285 return $r;
286 }
287
288 /**
289 * Returns the list of indices
290 *
291 * @param bool $localize
292 *
293 * @return array
294 */
295 public static function indices($localize = TRUE) {
296 $indices = [];
297 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
298 }
299
300 }