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:fdc6c79da7e1c0c60b5a5987ce42fd0d)
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',
181 'name' => 'mapping_id',
182 'type' => CRM_Utils_Type
::T_INT
,
183 'title' => ts('Mapping ID'),
184 'description' => ts('Mapping to which this field belongs'),
186 'where' => 'civicrm_mapping_field.mapping_id',
187 'table_name' => 'civicrm_mapping_field',
188 'entity' => 'MappingField',
189 'bao' => 'CRM_Core_DAO_MappingField',
191 'FKClassName' => 'CRM_Core_DAO_Mapping',
195 'type' => CRM_Utils_Type
::T_STRING
,
196 'title' => ts('Field Name (or unique reference)'),
197 'description' => ts('Mapping field key'),
199 'size' => CRM_Utils_Type
::HUGE
,
200 'where' => 'civicrm_mapping_field.name',
201 'table_name' => 'civicrm_mapping_field',
202 'entity' => 'MappingField',
203 'bao' => 'CRM_Core_DAO_MappingField',
207 'name' => 'contact_type',
208 'type' => CRM_Utils_Type
::T_STRING
,
209 'title' => ts('Contact Type'),
210 'description' => ts('Contact Type in mapping'),
212 'size' => CRM_Utils_Type
::BIG
,
213 'where' => 'civicrm_mapping_field.contact_type',
214 'table_name' => 'civicrm_mapping_field',
215 'entity' => 'MappingField',
216 'bao' => 'CRM_Core_DAO_MappingField',
223 'name' => 'column_number',
224 'type' => CRM_Utils_Type
::T_INT
,
225 'title' => ts('Column Number to map to'),
226 'description' => ts('Column number for mapping set'),
228 'where' => 'civicrm_mapping_field.column_number',
229 'table_name' => 'civicrm_mapping_field',
230 'entity' => 'MappingField',
231 'bao' => 'CRM_Core_DAO_MappingField',
234 'location_type_id' => [
235 'name' => 'location_type_id',
236 'type' => CRM_Utils_Type
::T_INT
,
237 'title' => ts('Location type ID'),
238 'description' => ts('Location type of this mapping, if required'),
239 'where' => 'civicrm_mapping_field.location_type_id',
240 'table_name' => 'civicrm_mapping_field',
241 'entity' => 'MappingField',
242 'bao' => 'CRM_Core_DAO_MappingField',
244 'FKClassName' => 'CRM_Core_DAO_LocationType',
245 'pseudoconstant' => [
246 'table' => 'civicrm_location_type',
248 'labelColumn' => 'display_name',
252 'name' => 'phone_type_id',
253 'type' => CRM_Utils_Type
::T_INT
,
254 'title' => ts('Phone Type'),
255 'description' => ts('Which type of phone does this number belongs.'),
256 'where' => 'civicrm_mapping_field.phone_type_id',
257 'table_name' => 'civicrm_mapping_field',
258 'entity' => 'MappingField',
259 'bao' => 'CRM_Core_DAO_MappingField',
262 'im_provider_id' => [
263 'name' => 'im_provider_id',
264 'type' => CRM_Utils_Type
::T_INT
,
265 'title' => ts('IM provider ID'),
266 'description' => ts('Which type of IM Provider does this name belong.'),
267 'where' => 'civicrm_mapping_field.im_provider_id',
268 'table_name' => 'civicrm_mapping_field',
269 'entity' => 'MappingField',
270 'bao' => 'CRM_Core_DAO_MappingField',
275 'pseudoconstant' => [
276 'optionGroupName' => 'instant_messenger_service',
277 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
280 'website_type_id' => [
281 'name' => 'website_type_id',
282 'type' => CRM_Utils_Type
::T_INT
,
283 'title' => ts('Website type ID'),
284 'description' => ts('Which type of website does this site belong'),
285 'where' => 'civicrm_mapping_field.website_type_id',
286 'table_name' => 'civicrm_mapping_field',
287 'entity' => 'MappingField',
288 'bao' => 'CRM_Core_DAO_MappingField',
293 'pseudoconstant' => [
294 'optionGroupName' => 'website_type',
295 'optionEditPath' => 'civicrm/admin/options/website_type',
298 'relationship_type_id' => [
299 'name' => 'relationship_type_id',
300 'type' => CRM_Utils_Type
::T_INT
,
301 'title' => ts('Relationship type ID'),
302 'description' => ts('Relationship type, if required'),
303 'where' => 'civicrm_mapping_field.relationship_type_id',
304 'table_name' => 'civicrm_mapping_field',
305 'entity' => 'MappingField',
306 'bao' => 'CRM_Core_DAO_MappingField',
308 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
310 'relationship_direction' => [
311 'name' => 'relationship_direction',
312 'type' => CRM_Utils_Type
::T_STRING
,
313 'title' => ts('Relationship Direction'),
315 'size' => CRM_Utils_Type
::SIX
,
316 'where' => 'civicrm_mapping_field.relationship_direction',
317 'table_name' => 'civicrm_mapping_field',
318 'entity' => 'MappingField',
319 'bao' => 'CRM_Core_DAO_MappingField',
323 'name' => 'grouping',
324 'type' => CRM_Utils_Type
::T_INT
,
325 'title' => ts('Field Grouping'),
326 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
328 'where' => 'civicrm_mapping_field.grouping',
330 'table_name' => 'civicrm_mapping_field',
331 'entity' => 'MappingField',
332 'bao' => 'CRM_Core_DAO_MappingField',
336 'name' => 'operator',
337 'type' => CRM_Utils_Type
::T_STRING
,
338 'title' => ts('Operator'),
339 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'),
341 'size' => CRM_Utils_Type
::TWELVE
,
342 'where' => 'civicrm_mapping_field.operator',
343 'table_name' => 'civicrm_mapping_field',
344 'entity' => 'MappingField',
345 'bao' => 'CRM_Core_DAO_MappingField',
350 'pseudoconstant' => [
351 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
356 'type' => CRM_Utils_Type
::T_STRING
,
357 'title' => ts('Search builder where clause'),
358 'description' => ts('SQL WHERE value for search-builder mapping fields.'),
360 'size' => CRM_Utils_Type
::HUGE
,
361 'where' => 'civicrm_mapping_field.value',
362 'table_name' => 'civicrm_mapping_field',
363 'entity' => 'MappingField',
364 'bao' => 'CRM_Core_DAO_MappingField',
368 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
370 return Civi
::$statics[__CLASS__
]['fields'];
374 * Return a mapping from field-name to the corresponding key (as used in fields()).
377 * Array(string $name => string $uniqueName).
379 public static function &fieldKeys() {
380 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
381 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
383 return Civi
::$statics[__CLASS__
]['fieldKeys'];
387 * Returns the names of this table
391 public static function getTableName() {
392 return self
::$_tableName;
396 * Returns if this table needs to be logged
400 public function getLog() {
405 * Returns the list of fields that can be imported
407 * @param bool $prefix
411 public static function &import($prefix = FALSE) {
412 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mapping_field', $prefix, []);
417 * Returns the list of fields that can be exported
419 * @param bool $prefix
423 public static function &export($prefix = FALSE) {
424 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mapping_field', $prefix, []);
429 * Returns the list of indices
431 * @param bool $localize
435 public static function indices($localize = TRUE) {
437 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;