Merge pull request #14072 from eileenmcnaughton/dao
[civicrm-core.git] / CRM / Core / DAO / MappingField.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/MappingField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4c827f0d31c1d9304836b198b0d93374)
10 */
11
12 /**
13 * Database access object for the MappingField entity.
14 */
15 class CRM_Core_DAO_MappingField extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_mapping_field';
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 * Mapping Field ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Mapping to which this field belongs
40 *
41 * @var int unsigned
42 */
43 public $mapping_id;
44
45 /**
46 * Mapping field key
47 *
48 * @var string
49 */
50 public $name;
51
52 /**
53 * Contact Type in mapping
54 *
55 * @var string
56 */
57 public $contact_type;
58
59 /**
60 * Column number for mapping set
61 *
62 * @var int unsigned
63 */
64 public $column_number;
65
66 /**
67 * Location type of this mapping, if required
68 *
69 * @var int unsigned
70 */
71 public $location_type_id;
72
73 /**
74 * Which type of phone does this number belongs.
75 *
76 * @var int unsigned
77 */
78 public $phone_type_id;
79
80 /**
81 * Which type of IM Provider does this name belong.
82 *
83 * @var int unsigned
84 */
85 public $im_provider_id;
86
87 /**
88 * Which type of website does this site belong
89 *
90 * @var int unsigned
91 */
92 public $website_type_id;
93
94 /**
95 * Relationship type, if required
96 *
97 * @var int unsigned
98 */
99 public $relationship_type_id;
100
101 /**
102 * @var string
103 */
104 public $relationship_direction;
105
106 /**
107 * Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
108 mappings).
109 *
110 * @var int unsigned
111 */
112 public $grouping;
113
114 /**
115 * SQL WHERE operator for search-builder mapping fields (search criteria).
116 *
117 * @var string
118 */
119 public $operator;
120
121 /**
122 * SQL WHERE value for search-builder mapping fields.
123 *
124 * @var string
125 */
126 public $value;
127
128 /**
129 * Class constructor.
130 */
131 public function __construct() {
132 $this->__table = 'civicrm_mapping_field';
133 parent::__construct();
134 }
135
136 /**
137 * Returns foreign keys and entity references.
138 *
139 * @return array
140 * [CRM_Core_Reference_Interface]
141 */
142 public static function getReferenceColumns() {
143 if (!isset(Civi::$statics[__CLASS__]['links'])) {
144 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
145 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mapping_id', 'civicrm_mapping', 'id');
146 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
147 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'relationship_type_id', 'civicrm_relationship_type', 'id');
148 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
149 }
150 return Civi::$statics[__CLASS__]['links'];
151 }
152
153 /**
154 * Returns all the column names of this table
155 *
156 * @return array
157 */
158 public static function &fields() {
159 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
160 Civi::$statics[__CLASS__]['fields'] = [
161 'id' => [
162 'name' => 'id',
163 'type' => CRM_Utils_Type::T_INT,
164 'title' => ts('Mapping Field ID'),
165 'description' => ts('Mapping Field ID'),
166 'required' => TRUE,
167 'where' => 'civicrm_mapping_field.id',
168 'table_name' => 'civicrm_mapping_field',
169 'entity' => 'MappingField',
170 'bao' => 'CRM_Core_DAO_MappingField',
171 'localizable' => 0,
172 ],
173 'mapping_id' => [
174 'name' => 'mapping_id',
175 'type' => CRM_Utils_Type::T_INT,
176 'title' => ts('Mapping ID'),
177 'description' => ts('Mapping to which this field belongs'),
178 'required' => TRUE,
179 'where' => 'civicrm_mapping_field.mapping_id',
180 'table_name' => 'civicrm_mapping_field',
181 'entity' => 'MappingField',
182 'bao' => 'CRM_Core_DAO_MappingField',
183 'localizable' => 0,
184 'FKClassName' => 'CRM_Core_DAO_Mapping',
185 ],
186 'name' => [
187 'name' => 'name',
188 'type' => CRM_Utils_Type::T_STRING,
189 'title' => ts('Name'),
190 'description' => ts('Mapping field key'),
191 'maxlength' => 255,
192 'size' => CRM_Utils_Type::HUGE,
193 'where' => 'civicrm_mapping_field.name',
194 'table_name' => 'civicrm_mapping_field',
195 'entity' => 'MappingField',
196 'bao' => 'CRM_Core_DAO_MappingField',
197 'localizable' => 0,
198 ],
199 'contact_type' => [
200 'name' => 'contact_type',
201 'type' => CRM_Utils_Type::T_STRING,
202 'title' => ts('Contact Type'),
203 'description' => ts('Contact Type in mapping'),
204 'maxlength' => 64,
205 'size' => CRM_Utils_Type::BIG,
206 'where' => 'civicrm_mapping_field.contact_type',
207 'table_name' => 'civicrm_mapping_field',
208 'entity' => 'MappingField',
209 'bao' => 'CRM_Core_DAO_MappingField',
210 'localizable' => 0,
211 'html' => [
212 'type' => 'Select',
213 ],
214 ],
215 'column_number' => [
216 'name' => 'column_number',
217 'type' => CRM_Utils_Type::T_INT,
218 'title' => ts('Column Number'),
219 'description' => ts('Column number for mapping set'),
220 'required' => TRUE,
221 'where' => 'civicrm_mapping_field.column_number',
222 'table_name' => 'civicrm_mapping_field',
223 'entity' => 'MappingField',
224 'bao' => 'CRM_Core_DAO_MappingField',
225 'localizable' => 0,
226 ],
227 'location_type_id' => [
228 'name' => 'location_type_id',
229 'type' => CRM_Utils_Type::T_INT,
230 'title' => ts('Location type ID'),
231 'description' => ts('Location type of this mapping, if required'),
232 'where' => 'civicrm_mapping_field.location_type_id',
233 'table_name' => 'civicrm_mapping_field',
234 'entity' => 'MappingField',
235 'bao' => 'CRM_Core_DAO_MappingField',
236 'localizable' => 0,
237 'FKClassName' => 'CRM_Core_DAO_LocationType',
238 ],
239 'phone_type_id' => [
240 'name' => 'phone_type_id',
241 'type' => CRM_Utils_Type::T_INT,
242 'title' => ts('Phone type ID'),
243 'description' => ts('Which type of phone does this number belongs.'),
244 'where' => 'civicrm_mapping_field.phone_type_id',
245 'table_name' => 'civicrm_mapping_field',
246 'entity' => 'MappingField',
247 'bao' => 'CRM_Core_DAO_MappingField',
248 'localizable' => 0,
249 ],
250 'im_provider_id' => [
251 'name' => 'im_provider_id',
252 'type' => CRM_Utils_Type::T_INT,
253 'title' => ts('IM provider ID'),
254 'description' => ts('Which type of IM Provider does this name belong.'),
255 'where' => 'civicrm_mapping_field.im_provider_id',
256 'table_name' => 'civicrm_mapping_field',
257 'entity' => 'MappingField',
258 'bao' => 'CRM_Core_DAO_MappingField',
259 'localizable' => 0,
260 'html' => [
261 'type' => 'Select',
262 ],
263 'pseudoconstant' => [
264 'optionGroupName' => 'instant_messenger_service',
265 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
266 ]
267 ],
268 'website_type_id' => [
269 'name' => 'website_type_id',
270 'type' => CRM_Utils_Type::T_INT,
271 'title' => ts('Website type ID'),
272 'description' => ts('Which type of website does this site belong'),
273 'where' => 'civicrm_mapping_field.website_type_id',
274 'table_name' => 'civicrm_mapping_field',
275 'entity' => 'MappingField',
276 'bao' => 'CRM_Core_DAO_MappingField',
277 'localizable' => 0,
278 'html' => [
279 'type' => 'Select',
280 ],
281 'pseudoconstant' => [
282 'optionGroupName' => 'website_type',
283 'optionEditPath' => 'civicrm/admin/options/website_type',
284 ]
285 ],
286 'relationship_type_id' => [
287 'name' => 'relationship_type_id',
288 'type' => CRM_Utils_Type::T_INT,
289 'title' => ts('Relationship type ID'),
290 'description' => ts('Relationship type, if required'),
291 'where' => 'civicrm_mapping_field.relationship_type_id',
292 'table_name' => 'civicrm_mapping_field',
293 'entity' => 'MappingField',
294 'bao' => 'CRM_Core_DAO_MappingField',
295 'localizable' => 0,
296 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
297 ],
298 'relationship_direction' => [
299 'name' => 'relationship_direction',
300 'type' => CRM_Utils_Type::T_STRING,
301 'title' => ts('Relationship Direction'),
302 'maxlength' => 6,
303 'size' => CRM_Utils_Type::SIX,
304 'where' => 'civicrm_mapping_field.relationship_direction',
305 'table_name' => 'civicrm_mapping_field',
306 'entity' => 'MappingField',
307 'bao' => 'CRM_Core_DAO_MappingField',
308 'localizable' => 0,
309 ],
310 'grouping' => [
311 'name' => 'grouping',
312 'type' => CRM_Utils_Type::T_INT,
313 'title' => ts('Grouping'),
314 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
315 mappings).
316 '),
317 'where' => 'civicrm_mapping_field.grouping',
318 'default' => '1',
319 'table_name' => 'civicrm_mapping_field',
320 'entity' => 'MappingField',
321 'bao' => 'CRM_Core_DAO_MappingField',
322 'localizable' => 0,
323 ],
324 'operator' => [
325 'name' => 'operator',
326 'type' => CRM_Utils_Type::T_STRING,
327 'title' => ts('Operator'),
328 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'),
329 'maxlength' => 16,
330 'size' => CRM_Utils_Type::TWELVE,
331 'where' => 'civicrm_mapping_field.operator',
332 'table_name' => 'civicrm_mapping_field',
333 'entity' => 'MappingField',
334 'bao' => 'CRM_Core_DAO_MappingField',
335 'localizable' => 0,
336 'html' => [
337 'type' => 'Select',
338 ],
339 'pseudoconstant' => [
340 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
341 ]
342 ],
343 'value' => [
344 'name' => 'value',
345 'type' => CRM_Utils_Type::T_STRING,
346 'title' => ts('Value'),
347 'description' => ts('SQL WHERE value for search-builder mapping fields.'),
348 'maxlength' => 255,
349 'size' => CRM_Utils_Type::HUGE,
350 'where' => 'civicrm_mapping_field.value',
351 'table_name' => 'civicrm_mapping_field',
352 'entity' => 'MappingField',
353 'bao' => 'CRM_Core_DAO_MappingField',
354 'localizable' => 0,
355 ],
356 ];
357 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
358 }
359 return Civi::$statics[__CLASS__]['fields'];
360 }
361
362 /**
363 * Return a mapping from field-name to the corresponding key (as used in fields()).
364 *
365 * @return array
366 * Array(string $name => string $uniqueName).
367 */
368 public static function &fieldKeys() {
369 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
370 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
371 }
372 return Civi::$statics[__CLASS__]['fieldKeys'];
373 }
374
375 /**
376 * Returns the names of this table
377 *
378 * @return string
379 */
380 public static function getTableName() {
381 return self::$_tableName;
382 }
383
384 /**
385 * Returns if this table needs to be logged
386 *
387 * @return bool
388 */
389 public function getLog() {
390 return self::$_log;
391 }
392
393 /**
394 * Returns the list of fields that can be imported
395 *
396 * @param bool $prefix
397 *
398 * @return array
399 */
400 public static function &import($prefix = FALSE) {
401 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping_field', $prefix, []);
402 return $r;
403 }
404
405 /**
406 * Returns the list of fields that can be exported
407 *
408 * @param bool $prefix
409 *
410 * @return array
411 */
412 public static function &export($prefix = FALSE) {
413 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping_field', $prefix, []);
414 return $r;
415 }
416
417 /**
418 * Returns the list of indices
419 *
420 * @param bool $localize
421 *
422 * @return array
423 */
424 public static function indices($localize = TRUE) {
425 $indices = [];
426 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
427 }
428
429 }