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