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