5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Core/MappingField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:11ff525a557ec58ebfa4fed22af699ea)
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 foreign keys and entity references.
140 * [CRM_Core_Reference_Interface]
142 public static function getReferenceColumns() {
143 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
144 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
145 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mapping_id', 'civicrm_mapping', 'id');
146 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
147 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'relationship_type_id', 'civicrm_relationship_type', 'id');
148 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
150 return Civi
::$statics[__CLASS__
]['links'];
154 * Returns all the column names of this table
158 public static function &fields() {
159 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
160 Civi
::$statics[__CLASS__
]['fields'] = [
163 'type' => CRM_Utils_Type
::T_INT
,
164 'title' => ts('Mapping Field ID'),
165 'description' => ts('Mapping Field ID'),
167 'where' => 'civicrm_mapping_field.id',
168 'table_name' => 'civicrm_mapping_field',
169 'entity' => 'MappingField',
170 'bao' => 'CRM_Core_DAO_MappingField',
174 'name' => 'mapping_id',
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Mapping ID'),
177 'description' => ts('Mapping to which this field belongs'),
179 'where' => 'civicrm_mapping_field.mapping_id',
180 'table_name' => 'civicrm_mapping_field',
181 'entity' => 'MappingField',
182 'bao' => 'CRM_Core_DAO_MappingField',
184 'FKClassName' => 'CRM_Core_DAO_Mapping',
188 'type' => CRM_Utils_Type
::T_STRING
,
189 'title' => ts('Field Name (or unique reference)'),
190 'description' => ts('Mapping field key'),
192 'size' => CRM_Utils_Type
::HUGE
,
193 'where' => 'civicrm_mapping_field.name',
194 'table_name' => 'civicrm_mapping_field',
195 'entity' => 'MappingField',
196 'bao' => 'CRM_Core_DAO_MappingField',
200 'name' => 'contact_type',
201 'type' => CRM_Utils_Type
::T_STRING
,
202 'title' => ts('Contact Type'),
203 'description' => ts('Contact Type in mapping'),
205 'size' => CRM_Utils_Type
::BIG
,
206 'where' => 'civicrm_mapping_field.contact_type',
207 'table_name' => 'civicrm_mapping_field',
208 'entity' => 'MappingField',
209 'bao' => 'CRM_Core_DAO_MappingField',
216 'name' => 'column_number',
217 'type' => CRM_Utils_Type
::T_INT
,
218 'title' => ts('Column Number to map to'),
219 'description' => ts('Column number for mapping set'),
221 'where' => 'civicrm_mapping_field.column_number',
222 'table_name' => 'civicrm_mapping_field',
223 'entity' => 'MappingField',
224 'bao' => 'CRM_Core_DAO_MappingField',
227 'location_type_id' => [
228 'name' => 'location_type_id',
229 'type' => CRM_Utils_Type
::T_INT
,
230 'title' => ts('Location type ID'),
231 'description' => ts('Location type of this mapping, if required'),
232 'where' => 'civicrm_mapping_field.location_type_id',
233 'table_name' => 'civicrm_mapping_field',
234 'entity' => 'MappingField',
235 'bao' => 'CRM_Core_DAO_MappingField',
237 'FKClassName' => 'CRM_Core_DAO_LocationType',
238 'pseudoconstant' => [
239 'table' => 'civicrm_location_type',
241 'labelColumn' => 'display_name',
245 'name' => 'phone_type_id',
246 'type' => CRM_Utils_Type
::T_INT
,
247 'title' => ts('Phone Type'),
248 'description' => ts('Which type of phone does this number belongs.'),
249 'where' => 'civicrm_mapping_field.phone_type_id',
250 'table_name' => 'civicrm_mapping_field',
251 'entity' => 'MappingField',
252 'bao' => 'CRM_Core_DAO_MappingField',
255 'im_provider_id' => [
256 'name' => 'im_provider_id',
257 'type' => CRM_Utils_Type
::T_INT
,
258 'title' => ts('IM provider ID'),
259 'description' => ts('Which type of IM Provider does this name belong.'),
260 'where' => 'civicrm_mapping_field.im_provider_id',
261 'table_name' => 'civicrm_mapping_field',
262 'entity' => 'MappingField',
263 'bao' => 'CRM_Core_DAO_MappingField',
268 'pseudoconstant' => [
269 'optionGroupName' => 'instant_messenger_service',
270 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
273 'website_type_id' => [
274 'name' => 'website_type_id',
275 'type' => CRM_Utils_Type
::T_INT
,
276 'title' => ts('Website type ID'),
277 'description' => ts('Which type of website does this site belong'),
278 'where' => 'civicrm_mapping_field.website_type_id',
279 'table_name' => 'civicrm_mapping_field',
280 'entity' => 'MappingField',
281 'bao' => 'CRM_Core_DAO_MappingField',
286 'pseudoconstant' => [
287 'optionGroupName' => 'website_type',
288 'optionEditPath' => 'civicrm/admin/options/website_type',
291 'relationship_type_id' => [
292 'name' => 'relationship_type_id',
293 'type' => CRM_Utils_Type
::T_INT
,
294 'title' => ts('Relationship type ID'),
295 'description' => ts('Relationship type, if required'),
296 'where' => 'civicrm_mapping_field.relationship_type_id',
297 'table_name' => 'civicrm_mapping_field',
298 'entity' => 'MappingField',
299 'bao' => 'CRM_Core_DAO_MappingField',
301 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
303 'relationship_direction' => [
304 'name' => 'relationship_direction',
305 'type' => CRM_Utils_Type
::T_STRING
,
306 'title' => ts('Relationship Direction'),
308 'size' => CRM_Utils_Type
::SIX
,
309 'where' => 'civicrm_mapping_field.relationship_direction',
310 'table_name' => 'civicrm_mapping_field',
311 'entity' => 'MappingField',
312 'bao' => 'CRM_Core_DAO_MappingField',
316 'name' => 'grouping',
317 'type' => CRM_Utils_Type
::T_INT
,
318 'title' => ts('Field Grouping'),
319 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
321 'where' => 'civicrm_mapping_field.grouping',
323 'table_name' => 'civicrm_mapping_field',
324 'entity' => 'MappingField',
325 'bao' => 'CRM_Core_DAO_MappingField',
329 'name' => 'operator',
330 'type' => CRM_Utils_Type
::T_STRING
,
331 'title' => ts('Operator'),
332 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'),
334 'size' => CRM_Utils_Type
::TWELVE
,
335 'where' => 'civicrm_mapping_field.operator',
336 'table_name' => 'civicrm_mapping_field',
337 'entity' => 'MappingField',
338 'bao' => 'CRM_Core_DAO_MappingField',
343 'pseudoconstant' => [
344 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
349 'type' => CRM_Utils_Type
::T_STRING
,
350 'title' => ts('Search builder where clause'),
351 'description' => ts('SQL WHERE value for search-builder mapping fields.'),
353 'size' => CRM_Utils_Type
::HUGE
,
354 'where' => 'civicrm_mapping_field.value',
355 'table_name' => 'civicrm_mapping_field',
356 'entity' => 'MappingField',
357 'bao' => 'CRM_Core_DAO_MappingField',
361 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
363 return Civi
::$statics[__CLASS__
]['fields'];
367 * Return a mapping from field-name to the corresponding key (as used in fields()).
370 * Array(string $name => string $uniqueName).
372 public static function &fieldKeys() {
373 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
374 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
376 return Civi
::$statics[__CLASS__
]['fieldKeys'];
380 * Returns the names of this table
384 public static function getTableName() {
385 return self
::$_tableName;
389 * Returns if this table needs to be logged
393 public function getLog() {
398 * Returns the list of fields that can be imported
400 * @param bool $prefix
404 public static function &import($prefix = FALSE) {
405 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mapping_field', $prefix, []);
410 * Returns the list of fields that can be exported
412 * @param bool $prefix
416 public static function &export($prefix = FALSE) {
417 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mapping_field', $prefix, []);
422 * Returns the list of indices
424 * @param bool $localize
428 public static function indices($localize = TRUE) {
430 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;