Merge pull request #13235 from civicrm/5.8
[civicrm-core.git] / CRM / Dedupe / DAO / RuleGroup.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Dedupe/RuleGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:85fc439e89d4d0dfd403efdd1cf67531)
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 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 static $_log = FALSE;
30
31 /**
32 * Unique dedupe rule group id
33 *
34 * @var int unsigned
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 boolean
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 all the column names of this table
90 *
91 * @return array
92 */
93 public static function &fields() {
94 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
95 Civi::$statics[__CLASS__]['fields'] = [
96 'id' => [
97 'name' => 'id',
98 'type' => CRM_Utils_Type::T_INT,
99 'title' => ts('Rule Group ID'),
100 'description' => ts('Unique dedupe rule group id'),
101 'required' => TRUE,
102 'table_name' => 'civicrm_dedupe_rule_group',
103 'entity' => 'RuleGroup',
104 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
105 'localizable' => 0,
106 ],
107 'contact_type' => [
108 'name' => 'contact_type',
109 'type' => CRM_Utils_Type::T_STRING,
110 'title' => ts('Contact Type'),
111 'description' => ts('The type of contacts this group applies to'),
112 'maxlength' => 12,
113 'size' => CRM_Utils_Type::TWELVE,
114 'table_name' => 'civicrm_dedupe_rule_group',
115 'entity' => 'RuleGroup',
116 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
117 'localizable' => 0,
118 'html' => [
119 'type' => 'Select',
120 ],
121 'pseudoconstant' => [
122 'table' => 'civicrm_contact_type',
123 'keyColumn' => 'name',
124 'labelColumn' => 'label',
125 'condition' => 'parent_id IS NULL',
126 ]
127 ],
128 'threshold' => [
129 'name' => 'threshold',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('Threshold'),
132 'description' => ts('The weight threshold the sum of the rule weights has to cross to consider two contacts the same'),
133 'required' => TRUE,
134 'table_name' => 'civicrm_dedupe_rule_group',
135 'entity' => 'RuleGroup',
136 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
137 'localizable' => 0,
138 'html' => [
139 'type' => 'Text',
140 ],
141 ],
142 'used' => [
143 'name' => 'used',
144 'type' => CRM_Utils_Type::T_STRING,
145 'title' => ts('Length'),
146 'description' => ts('Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically)'),
147 'required' => TRUE,
148 'maxlength' => 12,
149 'size' => CRM_Utils_Type::TWELVE,
150 'table_name' => 'civicrm_dedupe_rule_group',
151 'entity' => 'RuleGroup',
152 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
153 'localizable' => 0,
154 'html' => [
155 'type' => 'Radio',
156 ],
157 'pseudoconstant' => [
158 'callback' => 'CRM_Core_SelectValues::getDedupeRuleTypes',
159 ]
160 ],
161 'name' => [
162 'name' => 'name',
163 'type' => CRM_Utils_Type::T_STRING,
164 'title' => ts('Name'),
165 'description' => ts('Name of the rule group'),
166 'maxlength' => 64,
167 'size' => CRM_Utils_Type::BIG,
168 'table_name' => 'civicrm_dedupe_rule_group',
169 'entity' => 'RuleGroup',
170 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
171 'localizable' => 0,
172 ],
173 'title' => [
174 'name' => 'title',
175 'type' => CRM_Utils_Type::T_STRING,
176 'title' => ts('Title'),
177 'description' => ts('Label of the rule group'),
178 'maxlength' => 255,
179 'size' => CRM_Utils_Type::HUGE,
180 'table_name' => 'civicrm_dedupe_rule_group',
181 'entity' => 'RuleGroup',
182 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
183 'localizable' => 0,
184 'html' => [
185 'type' => 'Text',
186 ],
187 ],
188 'is_reserved' => [
189 'name' => 'is_reserved',
190 'type' => CRM_Utils_Type::T_BOOLEAN,
191 'title' => ts('Reserved?'),
192 'description' => ts('Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin'),
193 'table_name' => 'civicrm_dedupe_rule_group',
194 'entity' => 'RuleGroup',
195 'bao' => 'CRM_Dedupe_BAO_RuleGroup',
196 'localizable' => 0,
197 'html' => [
198 'type' => 'CheckBox',
199 ],
200 ],
201 ];
202 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
203 }
204 return Civi::$statics[__CLASS__]['fields'];
205 }
206
207 /**
208 * Return a mapping from field-name to the corresponding key (as used in fields()).
209 *
210 * @return array
211 * Array(string $name => string $uniqueName).
212 */
213 public static function &fieldKeys() {
214 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
215 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
216 }
217 return Civi::$statics[__CLASS__]['fieldKeys'];
218 }
219
220 /**
221 * Returns the names of this table
222 *
223 * @return string
224 */
225 public static function getTableName() {
226 return self::$_tableName;
227 }
228
229 /**
230 * Returns if this table needs to be logged
231 *
232 * @return bool
233 */
234 public function getLog() {
235 return self::$_log;
236 }
237
238 /**
239 * Returns the list of fields that can be imported
240 *
241 * @param bool $prefix
242 *
243 * @return array
244 */
245 public static function &import($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule_group', $prefix, []);
247 return $r;
248 }
249
250 /**
251 * Returns the list of fields that can be exported
252 *
253 * @param bool $prefix
254 *
255 * @return array
256 */
257 public static function &export($prefix = FALSE) {
258 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule_group', $prefix, []);
259 return $r;
260 }
261
262 /**
263 * Returns the list of indices
264 *
265 * @param bool $localize
266 *
267 * @return array
268 */
269 public static function indices($localize = TRUE) {
270 $indices = [];
271 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
272 }
273
274 }