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:c29cb464b46084c28cedf37c3757ffd1)
13 * Database access object for the MappingField entity.
15 class CRM_Core_DAO_MappingField
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_mapping_field';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
39 * Mapping to which this field belongs
53 * Contact Type in mapping
60 * Column number for mapping set
64 public $column_number;
67 * Location type of this mapping, if required
71 public $location_type_id;
74 * Which type of phone does this number belongs.
78 public $phone_type_id;
81 * Which type of IM Provider does this name belong.
85 public $im_provider_id;
88 * Which type of website does this site belong
92 public $website_type_id;
95 * Relationship type, if required
99 public $relationship_type_id;
104 public $relationship_direction;
107 * Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
115 * SQL WHERE operator for search-builder mapping fields (search criteria).
122 * SQL WHERE value for search-builder mapping fields.
131 public function __construct() {
132 $this->__table
= 'civicrm_mapping_field';
133 parent
::__construct();
137 * Returns localized title of this entity.
139 public static function getEntityTitle() {
140 return ts('Mapping Fields');
144 * Returns foreign keys and entity references.
147 * [CRM_Core_Reference_Interface]
149 public static function getReferenceColumns() {
150 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
151 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
152 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mapping_id', 'civicrm_mapping', 'id');
153 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
154 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'relationship_type_id', 'civicrm_relationship_type', 'id');
155 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
157 return Civi
::$statics[__CLASS__
]['links'];
161 * Returns all the column names of this table
165 public static function &fields() {
166 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
167 Civi
::$statics[__CLASS__
]['fields'] = [
170 'type' => CRM_Utils_Type
::T_INT
,
171 'title' => ts('Mapping Field ID'),
172 'description' => ts('Mapping Field ID'),
174 'where' => 'civicrm_mapping_field.id',
175 'table_name' => 'civicrm_mapping_field',
176 'entity' => 'MappingField',
177 'bao' => 'CRM_Core_DAO_MappingField',
182 'name' => 'mapping_id',
183 'type' => CRM_Utils_Type
::T_INT
,
184 'title' => ts('Mapping ID'),
185 'description' => ts('Mapping to which this field belongs'),
187 'where' => 'civicrm_mapping_field.mapping_id',
188 'table_name' => 'civicrm_mapping_field',
189 'entity' => 'MappingField',
190 'bao' => 'CRM_Core_DAO_MappingField',
192 'FKClassName' => 'CRM_Core_DAO_Mapping',
197 'type' => CRM_Utils_Type
::T_STRING
,
198 'title' => ts('Field Name (or unique reference)'),
199 'description' => ts('Mapping field key'),
201 'size' => CRM_Utils_Type
::HUGE
,
202 'where' => 'civicrm_mapping_field.name',
203 'table_name' => 'civicrm_mapping_field',
204 'entity' => 'MappingField',
205 'bao' => 'CRM_Core_DAO_MappingField',
210 'name' => 'contact_type',
211 'type' => CRM_Utils_Type
::T_STRING
,
212 'title' => ts('Contact Type'),
213 'description' => ts('Contact Type in mapping'),
215 'size' => CRM_Utils_Type
::BIG
,
216 'where' => 'civicrm_mapping_field.contact_type',
217 'table_name' => 'civicrm_mapping_field',
218 'entity' => 'MappingField',
219 'bao' => 'CRM_Core_DAO_MappingField',
227 'name' => 'column_number',
228 'type' => CRM_Utils_Type
::T_INT
,
229 'title' => ts('Column Number to map to'),
230 'description' => ts('Column number for mapping set'),
232 'where' => 'civicrm_mapping_field.column_number',
233 'table_name' => 'civicrm_mapping_field',
234 'entity' => 'MappingField',
235 'bao' => 'CRM_Core_DAO_MappingField',
239 'location_type_id' => [
240 'name' => 'location_type_id',
241 'type' => CRM_Utils_Type
::T_INT
,
242 'title' => ts('Location type ID'),
243 'description' => ts('Location type of this mapping, if required'),
244 'where' => 'civicrm_mapping_field.location_type_id',
245 'table_name' => 'civicrm_mapping_field',
246 'entity' => 'MappingField',
247 'bao' => 'CRM_Core_DAO_MappingField',
249 'FKClassName' => 'CRM_Core_DAO_LocationType',
250 'pseudoconstant' => [
251 'table' => 'civicrm_location_type',
253 'labelColumn' => 'display_name',
258 'name' => 'phone_type_id',
259 'type' => CRM_Utils_Type
::T_INT
,
260 'title' => ts('Phone Type'),
261 'description' => ts('Which type of phone does this number belongs.'),
262 'where' => 'civicrm_mapping_field.phone_type_id',
263 'table_name' => 'civicrm_mapping_field',
264 'entity' => 'MappingField',
265 'bao' => 'CRM_Core_DAO_MappingField',
269 'im_provider_id' => [
270 'name' => 'im_provider_id',
271 'type' => CRM_Utils_Type
::T_INT
,
272 'title' => ts('IM provider ID'),
273 'description' => ts('Which type of IM Provider does this name belong.'),
274 'where' => 'civicrm_mapping_field.im_provider_id',
275 'table_name' => 'civicrm_mapping_field',
276 'entity' => 'MappingField',
277 'bao' => 'CRM_Core_DAO_MappingField',
282 'pseudoconstant' => [
283 'optionGroupName' => 'instant_messenger_service',
284 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
288 'website_type_id' => [
289 'name' => 'website_type_id',
290 'type' => CRM_Utils_Type
::T_INT
,
291 'title' => ts('Website type ID'),
292 'description' => ts('Which type of website does this site belong'),
293 'where' => 'civicrm_mapping_field.website_type_id',
294 'table_name' => 'civicrm_mapping_field',
295 'entity' => 'MappingField',
296 'bao' => 'CRM_Core_DAO_MappingField',
301 'pseudoconstant' => [
302 'optionGroupName' => 'website_type',
303 'optionEditPath' => 'civicrm/admin/options/website_type',
307 'relationship_type_id' => [
308 'name' => 'relationship_type_id',
309 'type' => CRM_Utils_Type
::T_INT
,
310 'title' => ts('Relationship type ID'),
311 'description' => ts('Relationship type, if required'),
312 'where' => 'civicrm_mapping_field.relationship_type_id',
313 'table_name' => 'civicrm_mapping_field',
314 'entity' => 'MappingField',
315 'bao' => 'CRM_Core_DAO_MappingField',
317 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
320 'relationship_direction' => [
321 'name' => 'relationship_direction',
322 'type' => CRM_Utils_Type
::T_STRING
,
323 'title' => ts('Relationship Direction'),
325 'size' => CRM_Utils_Type
::SIX
,
326 'where' => 'civicrm_mapping_field.relationship_direction',
327 'table_name' => 'civicrm_mapping_field',
328 'entity' => 'MappingField',
329 'bao' => 'CRM_Core_DAO_MappingField',
334 'name' => 'grouping',
335 'type' => CRM_Utils_Type
::T_INT
,
336 'title' => ts('Field Grouping'),
337 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
339 'where' => 'civicrm_mapping_field.grouping',
341 'table_name' => 'civicrm_mapping_field',
342 'entity' => 'MappingField',
343 'bao' => 'CRM_Core_DAO_MappingField',
348 'name' => 'operator',
349 'type' => CRM_Utils_Type
::T_STRING
,
350 'title' => ts('Operator'),
351 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'),
353 'size' => CRM_Utils_Type
::TWELVE
,
354 'where' => 'civicrm_mapping_field.operator',
355 'table_name' => 'civicrm_mapping_field',
356 'entity' => 'MappingField',
357 'bao' => 'CRM_Core_DAO_MappingField',
362 'pseudoconstant' => [
363 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
369 'type' => CRM_Utils_Type
::T_STRING
,
370 'title' => ts('Search builder where clause'),
371 'description' => ts('SQL WHERE value for search-builder mapping fields.'),
373 'size' => CRM_Utils_Type
::HUGE
,
374 'where' => 'civicrm_mapping_field.value',
375 'table_name' => 'civicrm_mapping_field',
376 'entity' => 'MappingField',
377 'bao' => 'CRM_Core_DAO_MappingField',
382 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
384 return Civi
::$statics[__CLASS__
]['fields'];
388 * Return a mapping from field-name to the corresponding key (as used in fields()).
391 * Array(string $name => string $uniqueName).
393 public static function &fieldKeys() {
394 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
395 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
397 return Civi
::$statics[__CLASS__
]['fieldKeys'];
401 * Returns the names of this table
405 public static function getTableName() {
406 return self
::$_tableName;
410 * Returns if this table needs to be logged
414 public function getLog() {
419 * Returns the list of fields that can be imported
421 * @param bool $prefix
425 public static function &import($prefix = FALSE) {
426 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mapping_field', $prefix, []);
431 * Returns the list of fields that can be exported
433 * @param bool $prefix
437 public static function &export($prefix = FALSE) {
438 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mapping_field', $prefix, []);
443 * Returns the list of indices
445 * @param bool $localize
449 public static function indices($localize = TRUE) {
451 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;