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:7197da108e5452be6ab8b419a1506aec)
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',
187 'name' => 'mapping_id',
188 'type' => CRM_Utils_Type
::T_INT
,
189 'title' => ts('Mapping ID'),
190 'description' => ts('Mapping to which this field belongs'),
192 'where' => 'civicrm_mapping_field.mapping_id',
193 'table_name' => 'civicrm_mapping_field',
194 'entity' => 'MappingField',
195 'bao' => 'CRM_Core_DAO_MappingField',
197 'FKClassName' => 'CRM_Core_DAO_Mapping',
202 'type' => CRM_Utils_Type
::T_STRING
,
203 'title' => ts('Field Name (or unique reference)'),
204 'description' => ts('Mapping field key'),
206 'size' => CRM_Utils_Type
::HUGE
,
207 'where' => 'civicrm_mapping_field.name',
208 'table_name' => 'civicrm_mapping_field',
209 'entity' => 'MappingField',
210 'bao' => 'CRM_Core_DAO_MappingField',
215 'name' => 'contact_type',
216 'type' => CRM_Utils_Type
::T_STRING
,
217 'title' => ts('Contact Type'),
218 'description' => ts('Contact Type in mapping'),
220 'size' => CRM_Utils_Type
::BIG
,
221 'where' => 'civicrm_mapping_field.contact_type',
222 'table_name' => 'civicrm_mapping_field',
223 'entity' => 'MappingField',
224 'bao' => 'CRM_Core_DAO_MappingField',
232 'name' => 'column_number',
233 'type' => CRM_Utils_Type
::T_INT
,
234 'title' => ts('Column Number to map to'),
235 'description' => ts('Column number for mapping set'),
237 'where' => 'civicrm_mapping_field.column_number',
238 'table_name' => 'civicrm_mapping_field',
239 'entity' => 'MappingField',
240 'bao' => 'CRM_Core_DAO_MappingField',
244 'location_type_id' => [
245 'name' => 'location_type_id',
246 'type' => CRM_Utils_Type
::T_INT
,
247 'title' => ts('Location type ID'),
248 'description' => ts('Location type of this mapping, if required'),
249 'where' => 'civicrm_mapping_field.location_type_id',
250 'table_name' => 'civicrm_mapping_field',
251 'entity' => 'MappingField',
252 'bao' => 'CRM_Core_DAO_MappingField',
254 'FKClassName' => 'CRM_Core_DAO_LocationType',
255 'pseudoconstant' => [
256 'table' => 'civicrm_location_type',
258 'labelColumn' => 'display_name',
263 'name' => 'phone_type_id',
264 'type' => CRM_Utils_Type
::T_INT
,
265 'title' => ts('Phone Type'),
266 'description' => ts('Which type of phone does this number belongs.'),
267 'where' => 'civicrm_mapping_field.phone_type_id',
268 'table_name' => 'civicrm_mapping_field',
269 'entity' => 'MappingField',
270 'bao' => 'CRM_Core_DAO_MappingField',
274 'im_provider_id' => [
275 'name' => 'im_provider_id',
276 'type' => CRM_Utils_Type
::T_INT
,
277 'title' => ts('IM provider ID'),
278 'description' => ts('Which type of IM Provider does this name belong.'),
279 'where' => 'civicrm_mapping_field.im_provider_id',
280 'table_name' => 'civicrm_mapping_field',
281 'entity' => 'MappingField',
282 'bao' => 'CRM_Core_DAO_MappingField',
287 'pseudoconstant' => [
288 'optionGroupName' => 'instant_messenger_service',
289 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
293 'website_type_id' => [
294 'name' => 'website_type_id',
295 'type' => CRM_Utils_Type
::T_INT
,
296 'title' => ts('Website type ID'),
297 'description' => ts('Which type of website does this site belong'),
298 'where' => 'civicrm_mapping_field.website_type_id',
299 'table_name' => 'civicrm_mapping_field',
300 'entity' => 'MappingField',
301 'bao' => 'CRM_Core_DAO_MappingField',
306 'pseudoconstant' => [
307 'optionGroupName' => 'website_type',
308 'optionEditPath' => 'civicrm/admin/options/website_type',
312 'relationship_type_id' => [
313 'name' => 'relationship_type_id',
314 'type' => CRM_Utils_Type
::T_INT
,
315 'title' => ts('Relationship type ID'),
316 'description' => ts('Relationship type, if required'),
317 'where' => 'civicrm_mapping_field.relationship_type_id',
318 'table_name' => 'civicrm_mapping_field',
319 'entity' => 'MappingField',
320 'bao' => 'CRM_Core_DAO_MappingField',
322 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
325 'relationship_direction' => [
326 'name' => 'relationship_direction',
327 'type' => CRM_Utils_Type
::T_STRING
,
328 'title' => ts('Relationship Direction'),
330 'size' => CRM_Utils_Type
::SIX
,
331 'where' => 'civicrm_mapping_field.relationship_direction',
332 'table_name' => 'civicrm_mapping_field',
333 'entity' => 'MappingField',
334 'bao' => 'CRM_Core_DAO_MappingField',
339 'name' => 'grouping',
340 'type' => CRM_Utils_Type
::T_INT
,
341 'title' => ts('Field Grouping'),
342 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
344 'where' => 'civicrm_mapping_field.grouping',
346 'table_name' => 'civicrm_mapping_field',
347 'entity' => 'MappingField',
348 'bao' => 'CRM_Core_DAO_MappingField',
353 'name' => 'operator',
354 'type' => CRM_Utils_Type
::T_STRING
,
355 'title' => ts('Operator'),
356 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'),
358 'size' => CRM_Utils_Type
::TWELVE
,
359 'where' => 'civicrm_mapping_field.operator',
360 'table_name' => 'civicrm_mapping_field',
361 'entity' => 'MappingField',
362 'bao' => 'CRM_Core_DAO_MappingField',
367 'pseudoconstant' => [
368 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
374 'type' => CRM_Utils_Type
::T_STRING
,
375 'title' => ts('Search builder where clause'),
376 'description' => ts('SQL WHERE value for search-builder mapping fields.'),
378 'size' => CRM_Utils_Type
::HUGE
,
379 'where' => 'civicrm_mapping_field.value',
380 'table_name' => 'civicrm_mapping_field',
381 'entity' => 'MappingField',
382 'bao' => 'CRM_Core_DAO_MappingField',
387 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
389 return Civi
::$statics[__CLASS__
]['fields'];
393 * Return a mapping from field-name to the corresponding key (as used in fields()).
396 * Array(string $name => string $uniqueName).
398 public static function &fieldKeys() {
399 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
400 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
402 return Civi
::$statics[__CLASS__
]['fieldKeys'];
406 * Returns the names of this table
410 public static function getTableName() {
411 return self
::$_tableName;
415 * Returns if this table needs to be logged
419 public function getLog() {
424 * Returns the list of fields that can be imported
426 * @param bool $prefix
430 public static function &import($prefix = FALSE) {
431 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mapping_field', $prefix, []);
436 * Returns the list of fields that can be exported
438 * @param bool $prefix
442 public static function &export($prefix = FALSE) {
443 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mapping_field', $prefix, []);
448 * Returns the list of indices
450 * @param bool $localize
454 public static function indices($localize = TRUE) {
456 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;