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:c40af5559b03a60e0ca5588961b0f92d)
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',
240 'name' => 'phone_type_id',
241 'type' => CRM_Utils_Type
::T_INT
,
242 'title' => ts('Phone Type'),
243 'description' => ts('Which type of phone does this number belongs.'),
244 'where' => 'civicrm_mapping_field.phone_type_id',
245 'table_name' => 'civicrm_mapping_field',
246 'entity' => 'MappingField',
247 'bao' => 'CRM_Core_DAO_MappingField',
250 'im_provider_id' => [
251 'name' => 'im_provider_id',
252 'type' => CRM_Utils_Type
::T_INT
,
253 'title' => ts('IM provider ID'),
254 'description' => ts('Which type of IM Provider does this name belong.'),
255 'where' => 'civicrm_mapping_field.im_provider_id',
256 'table_name' => 'civicrm_mapping_field',
257 'entity' => 'MappingField',
258 'bao' => 'CRM_Core_DAO_MappingField',
263 'pseudoconstant' => [
264 'optionGroupName' => 'instant_messenger_service',
265 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
268 'website_type_id' => [
269 'name' => 'website_type_id',
270 'type' => CRM_Utils_Type
::T_INT
,
271 'title' => ts('Website type ID'),
272 'description' => ts('Which type of website does this site belong'),
273 'where' => 'civicrm_mapping_field.website_type_id',
274 'table_name' => 'civicrm_mapping_field',
275 'entity' => 'MappingField',
276 'bao' => 'CRM_Core_DAO_MappingField',
281 'pseudoconstant' => [
282 'optionGroupName' => 'website_type',
283 'optionEditPath' => 'civicrm/admin/options/website_type',
286 'relationship_type_id' => [
287 'name' => 'relationship_type_id',
288 'type' => CRM_Utils_Type
::T_INT
,
289 'title' => ts('Relationship type ID'),
290 'description' => ts('Relationship type, if required'),
291 'where' => 'civicrm_mapping_field.relationship_type_id',
292 'table_name' => 'civicrm_mapping_field',
293 'entity' => 'MappingField',
294 'bao' => 'CRM_Core_DAO_MappingField',
296 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
298 'relationship_direction' => [
299 'name' => 'relationship_direction',
300 'type' => CRM_Utils_Type
::T_STRING
,
301 'title' => ts('Relationship Direction'),
303 'size' => CRM_Utils_Type
::SIX
,
304 'where' => 'civicrm_mapping_field.relationship_direction',
305 'table_name' => 'civicrm_mapping_field',
306 'entity' => 'MappingField',
307 'bao' => 'CRM_Core_DAO_MappingField',
311 'name' => 'grouping',
312 'type' => CRM_Utils_Type
::T_INT
,
313 'title' => ts('Field Grouping'),
314 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
316 'where' => 'civicrm_mapping_field.grouping',
318 'table_name' => 'civicrm_mapping_field',
319 'entity' => 'MappingField',
320 'bao' => 'CRM_Core_DAO_MappingField',
324 'name' => 'operator',
325 'type' => CRM_Utils_Type
::T_STRING
,
326 'title' => ts('Operator'),
327 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'),
329 'size' => CRM_Utils_Type
::TWELVE
,
330 'where' => 'civicrm_mapping_field.operator',
331 'table_name' => 'civicrm_mapping_field',
332 'entity' => 'MappingField',
333 'bao' => 'CRM_Core_DAO_MappingField',
338 'pseudoconstant' => [
339 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
344 'type' => CRM_Utils_Type
::T_STRING
,
345 'title' => ts('Search builder where clause'),
346 'description' => ts('SQL WHERE value for search-builder mapping fields.'),
348 'size' => CRM_Utils_Type
::HUGE
,
349 'where' => 'civicrm_mapping_field.value',
350 'table_name' => 'civicrm_mapping_field',
351 'entity' => 'MappingField',
352 'bao' => 'CRM_Core_DAO_MappingField',
356 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
358 return Civi
::$statics[__CLASS__
]['fields'];
362 * Return a mapping from field-name to the corresponding key (as used in fields()).
365 * Array(string $name => string $uniqueName).
367 public static function &fieldKeys() {
368 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
369 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
371 return Civi
::$statics[__CLASS__
]['fieldKeys'];
375 * Returns the names of this table
379 public static function getTableName() {
380 return self
::$_tableName;
384 * Returns if this table needs to be logged
388 public function getLog() {
393 * Returns the list of fields that can be imported
395 * @param bool $prefix
399 public static function &import($prefix = FALSE) {
400 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mapping_field', $prefix, []);
405 * Returns the list of fields that can be exported
407 * @param bool $prefix
411 public static function &export($prefix = FALSE) {
412 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mapping_field', $prefix, []);
417 * Returns the list of indices
419 * @param bool $localize
423 public static function indices($localize = TRUE) {
425 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;