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:7b6fef105fbd75f712c39395b4dec8a9)
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;
41 * Mapping to which this field belongs
55 * Contact Type in mapping
62 * Column number for mapping set
66 public $column_number;
69 * Location type of this mapping, if required
73 public $location_type_id;
76 * Which type of phone does this number belongs.
80 public $phone_type_id;
83 * Which type of IM Provider does this name belong.
87 public $im_provider_id;
90 * Which type of website does this site belong
94 public $website_type_id;
97 * Relationship type, if required
101 public $relationship_type_id;
106 public $relationship_direction;
109 * Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
117 * SQL WHERE operator for search-builder mapping fields (search criteria).
124 * SQL WHERE value for search-builder mapping fields.
133 public function __construct() {
134 $this->__table
= 'civicrm_mapping_field';
135 parent
::__construct();
139 * Returns localized title of this entity.
141 * @param bool $plural
142 * Whether to return the plural version of the title.
144 public static function getEntityTitle($plural = FALSE) {
145 return $plural ?
ts('Mapping Fields') : ts('Mapping Field');
149 * Returns foreign keys and entity references.
152 * [CRM_Core_Reference_Interface]
154 public static function getReferenceColumns() {
155 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
156 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
157 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mapping_id', 'civicrm_mapping', 'id');
158 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
159 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'relationship_type_id', 'civicrm_relationship_type', 'id');
160 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
162 return Civi
::$statics[__CLASS__
]['links'];
166 * Returns all the column names of this table
170 public static function &fields() {
171 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
172 Civi
::$statics[__CLASS__
]['fields'] = [
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Mapping Field ID'),
177 'description' => ts('Mapping Field ID'),
179 'where' => 'civicrm_mapping_field.id',
180 'table_name' => 'civicrm_mapping_field',
181 'entity' => 'MappingField',
182 'bao' => 'CRM_Core_DAO_MappingField',
191 'name' => 'mapping_id',
192 'type' => CRM_Utils_Type
::T_INT
,
193 'title' => ts('Mapping ID'),
194 'description' => ts('Mapping to which this field belongs'),
196 'where' => 'civicrm_mapping_field.mapping_id',
197 'table_name' => 'civicrm_mapping_field',
198 'entity' => 'MappingField',
199 'bao' => 'CRM_Core_DAO_MappingField',
201 'FKClassName' => 'CRM_Core_DAO_Mapping',
203 'label' => ts("Mapping"),
209 'type' => CRM_Utils_Type
::T_STRING
,
210 'title' => ts('Field Name (or unique reference)'),
211 'description' => ts('Mapping field key'),
213 'size' => CRM_Utils_Type
::HUGE
,
214 'where' => 'civicrm_mapping_field.name',
215 'table_name' => 'civicrm_mapping_field',
216 'entity' => 'MappingField',
217 'bao' => 'CRM_Core_DAO_MappingField',
222 'name' => 'contact_type',
223 'type' => CRM_Utils_Type
::T_STRING
,
224 'title' => ts('Contact Type'),
225 'description' => ts('Contact Type in mapping'),
227 'size' => CRM_Utils_Type
::BIG
,
228 'where' => 'civicrm_mapping_field.contact_type',
229 'table_name' => 'civicrm_mapping_field',
230 'entity' => 'MappingField',
231 'bao' => 'CRM_Core_DAO_MappingField',
239 'name' => 'column_number',
240 'type' => CRM_Utils_Type
::T_INT
,
241 'title' => ts('Column Number to map to'),
242 'description' => ts('Column number for mapping set'),
244 'where' => 'civicrm_mapping_field.column_number',
245 'table_name' => 'civicrm_mapping_field',
246 'entity' => 'MappingField',
247 'bao' => 'CRM_Core_DAO_MappingField',
251 'location_type_id' => [
252 'name' => 'location_type_id',
253 'type' => CRM_Utils_Type
::T_INT
,
254 'title' => ts('Location type ID'),
255 'description' => ts('Location type of this mapping, if required'),
256 'where' => 'civicrm_mapping_field.location_type_id',
257 'table_name' => 'civicrm_mapping_field',
258 'entity' => 'MappingField',
259 'bao' => 'CRM_Core_DAO_MappingField',
261 'FKClassName' => 'CRM_Core_DAO_LocationType',
263 'label' => ts("Location type"),
265 'pseudoconstant' => [
266 'table' => 'civicrm_location_type',
268 'labelColumn' => 'display_name',
273 'name' => 'phone_type_id',
274 'type' => CRM_Utils_Type
::T_INT
,
275 'title' => ts('Phone type ID'),
276 'description' => ts('Which type of phone does this number belongs.'),
277 'where' => 'civicrm_mapping_field.phone_type_id',
278 'table_name' => 'civicrm_mapping_field',
279 'entity' => 'MappingField',
280 'bao' => 'CRM_Core_DAO_MappingField',
284 'im_provider_id' => [
285 'name' => 'im_provider_id',
286 'type' => CRM_Utils_Type
::T_INT
,
287 'title' => ts('IM provider ID'),
288 'description' => ts('Which type of IM Provider does this name belong.'),
289 'where' => 'civicrm_mapping_field.im_provider_id',
290 'table_name' => 'civicrm_mapping_field',
291 'entity' => 'MappingField',
292 'bao' => 'CRM_Core_DAO_MappingField',
297 'pseudoconstant' => [
298 'optionGroupName' => 'instant_messenger_service',
299 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
303 'website_type_id' => [
304 'name' => 'website_type_id',
305 'type' => CRM_Utils_Type
::T_INT
,
306 'title' => ts('Website type ID'),
307 'description' => ts('Which type of website does this site belong'),
308 'where' => 'civicrm_mapping_field.website_type_id',
309 'table_name' => 'civicrm_mapping_field',
310 'entity' => 'MappingField',
311 'bao' => 'CRM_Core_DAO_MappingField',
316 'pseudoconstant' => [
317 'optionGroupName' => 'website_type',
318 'optionEditPath' => 'civicrm/admin/options/website_type',
322 'relationship_type_id' => [
323 'name' => 'relationship_type_id',
324 'type' => CRM_Utils_Type
::T_INT
,
325 'title' => ts('Relationship type ID'),
326 'description' => ts('Relationship type, if required'),
327 'where' => 'civicrm_mapping_field.relationship_type_id',
328 'table_name' => 'civicrm_mapping_field',
329 'entity' => 'MappingField',
330 'bao' => 'CRM_Core_DAO_MappingField',
332 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
334 'label' => ts("Relationship type"),
338 'relationship_direction' => [
339 'name' => 'relationship_direction',
340 'type' => CRM_Utils_Type
::T_STRING
,
341 'title' => ts('Relationship Direction'),
343 'size' => CRM_Utils_Type
::SIX
,
344 'where' => 'civicrm_mapping_field.relationship_direction',
345 'table_name' => 'civicrm_mapping_field',
346 'entity' => 'MappingField',
347 'bao' => 'CRM_Core_DAO_MappingField',
352 'name' => 'grouping',
353 'type' => CRM_Utils_Type
::T_INT
,
354 'title' => ts('Field Grouping'),
355 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
357 'where' => 'civicrm_mapping_field.grouping',
359 'table_name' => 'civicrm_mapping_field',
360 'entity' => 'MappingField',
361 'bao' => 'CRM_Core_DAO_MappingField',
366 'name' => 'operator',
367 'type' => CRM_Utils_Type
::T_STRING
,
368 'title' => ts('Operator'),
369 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'),
371 'size' => CRM_Utils_Type
::TWELVE
,
372 'where' => 'civicrm_mapping_field.operator',
373 'table_name' => 'civicrm_mapping_field',
374 'entity' => 'MappingField',
375 'bao' => 'CRM_Core_DAO_MappingField',
380 'pseudoconstant' => [
381 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
387 'type' => CRM_Utils_Type
::T_STRING
,
388 'title' => ts('Search builder where clause'),
389 'description' => ts('SQL WHERE value for search-builder mapping fields.'),
391 'size' => CRM_Utils_Type
::HUGE
,
392 'where' => 'civicrm_mapping_field.value',
393 'table_name' => 'civicrm_mapping_field',
394 'entity' => 'MappingField',
395 'bao' => 'CRM_Core_DAO_MappingField',
400 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
402 return Civi
::$statics[__CLASS__
]['fields'];
406 * Return a mapping from field-name to the corresponding key (as used in fields()).
409 * Array(string $name => string $uniqueName).
411 public static function &fieldKeys() {
412 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
413 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
415 return Civi
::$statics[__CLASS__
]['fieldKeys'];
419 * Returns the names of this table
423 public static function getTableName() {
424 return self
::$_tableName;
428 * Returns if this table needs to be logged
432 public function getLog() {
437 * Returns the list of fields that can be imported
439 * @param bool $prefix
443 public static function &import($prefix = FALSE) {
444 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mapping_field', $prefix, []);
449 * Returns the list of fields that can be exported
451 * @param bool $prefix
455 public static function &export($prefix = FALSE) {
456 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mapping_field', $prefix, []);
461 * Returns the list of indices
463 * @param bool $localize
467 public static function indices($localize = TRUE) {
469 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;