Merge pull request #15361 from seamuslee001/index_geo_code_fields
[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:11ff525a557ec58ebfa4fed22af699ea)
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
35 */
36 public $id;
37
38 /**
39 * Mapping to which this field belongs
40 *
41 * @var int
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
63 */
64 public $column_number;
65
66 /**
67 * Location type of this mapping, if required
68 *
69 * @var int
70 */
71 public $location_type_id;
72
73 /**
74 * Which type of phone does this number belongs.
75 *
76 * @var int
77 */
78 public $phone_type_id;
79
80 /**
81 * Which type of IM Provider does this name belong.
82 *
83 * @var int
84 */
85 public $im_provider_id;
86
87 /**
88 * Which type of website does this site belong
89 *
90 * @var int
91 */
92 public $website_type_id;
93
94 /**
95 * Relationship type, if required
96 *
97 * @var int
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
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('Field Name (or unique reference)'),
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 to map to'),
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 'pseudoconstant' => [
239 'table' => 'civicrm_location_type',
240 'keyColumn' => 'id',
241 'labelColumn' => 'display_name',
242 ],
243 ],
244 'phone_type_id' => [
245 'name' => 'phone_type_id',
246 'type' => CRM_Utils_Type::T_INT,
247 'title' => ts('Phone Type'),
248 'description' => ts('Which type of phone does this number belongs.'),
249 'where' => 'civicrm_mapping_field.phone_type_id',
250 'table_name' => 'civicrm_mapping_field',
251 'entity' => 'MappingField',
252 'bao' => 'CRM_Core_DAO_MappingField',
253 'localizable' => 0,
254 ],
255 'im_provider_id' => [
256 'name' => 'im_provider_id',
257 'type' => CRM_Utils_Type::T_INT,
258 'title' => ts('IM provider ID'),
259 'description' => ts('Which type of IM Provider does this name belong.'),
260 'where' => 'civicrm_mapping_field.im_provider_id',
261 'table_name' => 'civicrm_mapping_field',
262 'entity' => 'MappingField',
263 'bao' => 'CRM_Core_DAO_MappingField',
264 'localizable' => 0,
265 'html' => [
266 'type' => 'Select',
267 ],
268 'pseudoconstant' => [
269 'optionGroupName' => 'instant_messenger_service',
270 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
271 ],
272 ],
273 'website_type_id' => [
274 'name' => 'website_type_id',
275 'type' => CRM_Utils_Type::T_INT,
276 'title' => ts('Website type ID'),
277 'description' => ts('Which type of website does this site belong'),
278 'where' => 'civicrm_mapping_field.website_type_id',
279 'table_name' => 'civicrm_mapping_field',
280 'entity' => 'MappingField',
281 'bao' => 'CRM_Core_DAO_MappingField',
282 'localizable' => 0,
283 'html' => [
284 'type' => 'Select',
285 ],
286 'pseudoconstant' => [
287 'optionGroupName' => 'website_type',
288 'optionEditPath' => 'civicrm/admin/options/website_type',
289 ],
290 ],
291 'relationship_type_id' => [
292 'name' => 'relationship_type_id',
293 'type' => CRM_Utils_Type::T_INT,
294 'title' => ts('Relationship type ID'),
295 'description' => ts('Relationship type, if required'),
296 'where' => 'civicrm_mapping_field.relationship_type_id',
297 'table_name' => 'civicrm_mapping_field',
298 'entity' => 'MappingField',
299 'bao' => 'CRM_Core_DAO_MappingField',
300 'localizable' => 0,
301 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
302 ],
303 'relationship_direction' => [
304 'name' => 'relationship_direction',
305 'type' => CRM_Utils_Type::T_STRING,
306 'title' => ts('Relationship Direction'),
307 'maxlength' => 6,
308 'size' => CRM_Utils_Type::SIX,
309 'where' => 'civicrm_mapping_field.relationship_direction',
310 'table_name' => 'civicrm_mapping_field',
311 'entity' => 'MappingField',
312 'bao' => 'CRM_Core_DAO_MappingField',
313 'localizable' => 0,
314 ],
315 'grouping' => [
316 'name' => 'grouping',
317 'type' => CRM_Utils_Type::T_INT,
318 'title' => ts('Field Grouping'),
319 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
320 mappings).'),
321 'where' => 'civicrm_mapping_field.grouping',
322 'default' => '1',
323 'table_name' => 'civicrm_mapping_field',
324 'entity' => 'MappingField',
325 'bao' => 'CRM_Core_DAO_MappingField',
326 'localizable' => 0,
327 ],
328 'operator' => [
329 'name' => 'operator',
330 'type' => CRM_Utils_Type::T_STRING,
331 'title' => ts('Operator'),
332 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'),
333 'maxlength' => 16,
334 'size' => CRM_Utils_Type::TWELVE,
335 'where' => 'civicrm_mapping_field.operator',
336 'table_name' => 'civicrm_mapping_field',
337 'entity' => 'MappingField',
338 'bao' => 'CRM_Core_DAO_MappingField',
339 'localizable' => 0,
340 'html' => [
341 'type' => 'Select',
342 ],
343 'pseudoconstant' => [
344 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
345 ],
346 ],
347 'value' => [
348 'name' => 'value',
349 'type' => CRM_Utils_Type::T_STRING,
350 'title' => ts('Search builder where clause'),
351 'description' => ts('SQL WHERE value for search-builder mapping fields.'),
352 'maxlength' => 255,
353 'size' => CRM_Utils_Type::HUGE,
354 'where' => 'civicrm_mapping_field.value',
355 'table_name' => 'civicrm_mapping_field',
356 'entity' => 'MappingField',
357 'bao' => 'CRM_Core_DAO_MappingField',
358 'localizable' => 0,
359 ],
360 ];
361 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
362 }
363 return Civi::$statics[__CLASS__]['fields'];
364 }
365
366 /**
367 * Return a mapping from field-name to the corresponding key (as used in fields()).
368 *
369 * @return array
370 * Array(string $name => string $uniqueName).
371 */
372 public static function &fieldKeys() {
373 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
374 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
375 }
376 return Civi::$statics[__CLASS__]['fieldKeys'];
377 }
378
379 /**
380 * Returns the names of this table
381 *
382 * @return string
383 */
384 public static function getTableName() {
385 return self::$_tableName;
386 }
387
388 /**
389 * Returns if this table needs to be logged
390 *
391 * @return bool
392 */
393 public function getLog() {
394 return self::$_log;
395 }
396
397 /**
398 * Returns the list of fields that can be imported
399 *
400 * @param bool $prefix
401 *
402 * @return array
403 */
404 public static function &import($prefix = FALSE) {
405 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping_field', $prefix, []);
406 return $r;
407 }
408
409 /**
410 * Returns the list of fields that can be exported
411 *
412 * @param bool $prefix
413 *
414 * @return array
415 */
416 public static function &export($prefix = FALSE) {
417 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping_field', $prefix, []);
418 return $r;
419 }
420
421 /**
422 * Returns the list of indices
423 *
424 * @param bool $localize
425 *
426 * @return array
427 */
428 public static function indices($localize = TRUE) {
429 $indices = [];
430 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
431 }
432
433 }