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