5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/MappingField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:43e4b1c405dfce18840eca9d73aa70e7)
13 * Database access object for the MappingField entity.
15 class CRM_Core_DAO_MappingField
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.2';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_mapping_field';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Mapping to which this field belongs
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
55 * (SQL type: varchar(255))
56 * Note that values will be retrieved from the database as a string.
61 * Contact Type in mapping
64 * (SQL type: varchar(64))
65 * Note that values will be retrieved from the database as a string.
70 * Column number for mapping set
73 * (SQL type: int unsigned)
74 * Note that values will be retrieved from the database as a string.
76 public $column_number;
79 * Location type of this mapping, if required
81 * @var int|string|null
82 * (SQL type: int unsigned)
83 * Note that values will be retrieved from the database as a string.
85 public $location_type_id;
88 * Which type of phone does this number belongs.
90 * @var int|string|null
91 * (SQL type: int unsigned)
92 * Note that values will be retrieved from the database as a string.
94 public $phone_type_id;
97 * Which type of IM Provider does this name belong.
99 * @var int|string|null
100 * (SQL type: int unsigned)
101 * Note that values will be retrieved from the database as a string.
103 public $im_provider_id;
106 * Which type of website does this site belong
108 * @var int|string|null
109 * (SQL type: int unsigned)
110 * Note that values will be retrieved from the database as a string.
112 public $website_type_id;
115 * Relationship type, if required
117 * @var int|string|null
118 * (SQL type: int unsigned)
119 * Note that values will be retrieved from the database as a string.
121 public $relationship_type_id;
125 * (SQL type: varchar(6))
126 * Note that values will be retrieved from the database as a string.
128 public $relationship_direction;
131 * Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
134 * @var int|string|null
135 * (SQL type: int unsigned)
136 * Note that values will be retrieved from the database as a string.
141 * SQL WHERE operator for search-builder mapping fields (search criteria).
144 * (SQL type: varchar(16))
145 * Note that values will be retrieved from the database as a string.
150 * SQL WHERE value for search-builder mapping fields.
153 * (SQL type: varchar(255))
154 * Note that values will be retrieved from the database as a string.
161 public function __construct() {
162 $this->__table
= 'civicrm_mapping_field';
163 parent
::__construct();
167 * Returns localized title of this entity.
169 * @param bool $plural
170 * Whether to return the plural version of the title.
172 public static function getEntityTitle($plural = FALSE) {
173 return $plural ?
ts('Mapping Fields') : ts('Mapping Field');
177 * Returns foreign keys and entity references.
180 * [CRM_Core_Reference_Interface]
182 public static function getReferenceColumns() {
183 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
184 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
185 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mapping_id', 'civicrm_mapping', 'id');
186 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
187 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'relationship_type_id', 'civicrm_relationship_type', 'id');
188 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
190 return Civi
::$statics[__CLASS__
]['links'];
194 * Returns all the column names of this table
198 public static function &fields() {
199 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
200 Civi
::$statics[__CLASS__
]['fields'] = [
203 'type' => CRM_Utils_Type
::T_INT
,
204 'title' => ts('Mapping Field ID'),
205 'description' => ts('Mapping Field ID'),
207 'where' => 'civicrm_mapping_field.id',
208 'table_name' => 'civicrm_mapping_field',
209 'entity' => 'MappingField',
210 'bao' => 'CRM_Core_DAO_MappingField',
219 'name' => 'mapping_id',
220 'type' => CRM_Utils_Type
::T_INT
,
221 'title' => ts('Mapping ID'),
222 'description' => ts('Mapping to which this field belongs'),
224 'where' => 'civicrm_mapping_field.mapping_id',
225 'table_name' => 'civicrm_mapping_field',
226 'entity' => 'MappingField',
227 'bao' => 'CRM_Core_DAO_MappingField',
229 'FKClassName' => 'CRM_Core_DAO_Mapping',
231 'label' => ts("Mapping"),
237 'type' => CRM_Utils_Type
::T_STRING
,
238 'title' => ts('Field Name (or unique reference)'),
239 'description' => ts('Mapping field key'),
241 'size' => CRM_Utils_Type
::HUGE
,
242 'where' => 'civicrm_mapping_field.name',
243 'table_name' => 'civicrm_mapping_field',
244 'entity' => 'MappingField',
245 'bao' => 'CRM_Core_DAO_MappingField',
250 'name' => 'contact_type',
251 'type' => CRM_Utils_Type
::T_STRING
,
252 'title' => ts('Contact Type'),
253 'description' => ts('Contact Type in mapping'),
255 'size' => CRM_Utils_Type
::BIG
,
256 'where' => 'civicrm_mapping_field.contact_type',
257 'table_name' => 'civicrm_mapping_field',
258 'entity' => 'MappingField',
259 'bao' => 'CRM_Core_DAO_MappingField',
267 'name' => 'column_number',
268 'type' => CRM_Utils_Type
::T_INT
,
269 'title' => ts('Column Number to map to'),
270 'description' => ts('Column number for mapping set'),
272 'where' => 'civicrm_mapping_field.column_number',
273 'table_name' => 'civicrm_mapping_field',
274 'entity' => 'MappingField',
275 'bao' => 'CRM_Core_DAO_MappingField',
279 'location_type_id' => [
280 'name' => 'location_type_id',
281 'type' => CRM_Utils_Type
::T_INT
,
282 'title' => ts('Location type ID'),
283 'description' => ts('Location type of this mapping, if required'),
284 'where' => 'civicrm_mapping_field.location_type_id',
285 'table_name' => 'civicrm_mapping_field',
286 'entity' => 'MappingField',
287 'bao' => 'CRM_Core_DAO_MappingField',
289 'FKClassName' => 'CRM_Core_DAO_LocationType',
291 'label' => ts("Location type"),
293 'pseudoconstant' => [
294 'table' => 'civicrm_location_type',
296 'labelColumn' => 'display_name',
301 'name' => 'phone_type_id',
302 'type' => CRM_Utils_Type
::T_INT
,
303 'title' => ts('Phone type ID'),
304 'description' => ts('Which type of phone does this number belongs.'),
305 'where' => 'civicrm_mapping_field.phone_type_id',
306 'table_name' => 'civicrm_mapping_field',
307 'entity' => 'MappingField',
308 'bao' => 'CRM_Core_DAO_MappingField',
312 'im_provider_id' => [
313 'name' => 'im_provider_id',
314 'type' => CRM_Utils_Type
::T_INT
,
315 'title' => ts('IM provider ID'),
316 'description' => ts('Which type of IM Provider does this name belong.'),
317 'where' => 'civicrm_mapping_field.im_provider_id',
318 'table_name' => 'civicrm_mapping_field',
319 'entity' => 'MappingField',
320 'bao' => 'CRM_Core_DAO_MappingField',
325 'pseudoconstant' => [
326 'optionGroupName' => 'instant_messenger_service',
327 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
331 'website_type_id' => [
332 'name' => 'website_type_id',
333 'type' => CRM_Utils_Type
::T_INT
,
334 'title' => ts('Website type ID'),
335 'description' => ts('Which type of website does this site belong'),
336 'where' => 'civicrm_mapping_field.website_type_id',
337 'table_name' => 'civicrm_mapping_field',
338 'entity' => 'MappingField',
339 'bao' => 'CRM_Core_DAO_MappingField',
344 'pseudoconstant' => [
345 'optionGroupName' => 'website_type',
346 'optionEditPath' => 'civicrm/admin/options/website_type',
350 'relationship_type_id' => [
351 'name' => 'relationship_type_id',
352 'type' => CRM_Utils_Type
::T_INT
,
353 'title' => ts('Relationship type ID'),
354 'description' => ts('Relationship type, if required'),
355 'where' => 'civicrm_mapping_field.relationship_type_id',
356 'table_name' => 'civicrm_mapping_field',
357 'entity' => 'MappingField',
358 'bao' => 'CRM_Core_DAO_MappingField',
360 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
362 'label' => ts("Relationship type"),
366 'relationship_direction' => [
367 'name' => 'relationship_direction',
368 'type' => CRM_Utils_Type
::T_STRING
,
369 'title' => ts('Relationship Direction'),
371 'size' => CRM_Utils_Type
::SIX
,
372 'where' => 'civicrm_mapping_field.relationship_direction',
373 'table_name' => 'civicrm_mapping_field',
374 'entity' => 'MappingField',
375 'bao' => 'CRM_Core_DAO_MappingField',
380 'name' => 'grouping',
381 'type' => CRM_Utils_Type
::T_INT
,
382 'title' => ts('Field Grouping'),
383 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
385 'where' => 'civicrm_mapping_field.grouping',
387 'table_name' => 'civicrm_mapping_field',
388 'entity' => 'MappingField',
389 'bao' => 'CRM_Core_DAO_MappingField',
394 'name' => 'operator',
395 'type' => CRM_Utils_Type
::T_STRING
,
396 'title' => ts('Operator'),
397 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'),
399 'size' => CRM_Utils_Type
::TWELVE
,
400 'where' => 'civicrm_mapping_field.operator',
401 'table_name' => 'civicrm_mapping_field',
402 'entity' => 'MappingField',
403 'bao' => 'CRM_Core_DAO_MappingField',
408 'pseudoconstant' => [
409 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
415 'type' => CRM_Utils_Type
::T_STRING
,
416 'title' => ts('Search builder where clause'),
417 'description' => ts('SQL WHERE value for search-builder mapping fields.'),
419 'size' => CRM_Utils_Type
::HUGE
,
420 'where' => 'civicrm_mapping_field.value',
421 'table_name' => 'civicrm_mapping_field',
422 'entity' => 'MappingField',
423 'bao' => 'CRM_Core_DAO_MappingField',
428 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
430 return Civi
::$statics[__CLASS__
]['fields'];
434 * Return a mapping from field-name to the corresponding key (as used in fields()).
437 * Array(string $name => string $uniqueName).
439 public static function &fieldKeys() {
440 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
441 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
443 return Civi
::$statics[__CLASS__
]['fieldKeys'];
447 * Returns the names of this table
451 public static function getTableName() {
452 return self
::$_tableName;
456 * Returns if this table needs to be logged
460 public function getLog() {
465 * Returns the list of fields that can be imported
467 * @param bool $prefix
471 public static function &import($prefix = FALSE) {
472 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mapping_field', $prefix, []);
477 * Returns the list of fields that can be exported
479 * @param bool $prefix
483 public static function &export($prefix = FALSE) {
484 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mapping_field', $prefix, []);
489 * Returns the list of indices
491 * @param bool $localize
495 public static function indices($localize = TRUE) {
497 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;