Merge pull request #13267 from seamuslee001/copywrite_year_update
[civicrm-core.git] / CRM / Core / DAO / MappingField.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/MappingField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4c827f0d31c1d9304836b198b0d93374)
10 */
11
12 /**
13 * Database access object for the MappingField entity.
14 */
15 class CRM_Core_DAO_MappingField extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_mapping_field';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 static $_log = FALSE;
30
31 /**
32 * Mapping Field ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Mapping to which this field belongs
40 *
41 * @var int unsigned
42 */
43 public $mapping_id;
44
45 /**
46 * Mapping field key
47 *
48 * @var string
49 */
50 public $name;
51
52 /**
53 * Contact Type in mapping
54 *
55 * @var string
56 */
57 public $contact_type;
58
59 /**
60 * Column number for mapping set
61 *
62 * @var int unsigned
63 */
64 public $column_number;
65
66 /**
67 * Location type of this mapping, if required
68 *
69 * @var int unsigned
70 */
71 public $location_type_id;
72
73 /**
74 * Which type of phone does this number belongs.
75 *
76 * @var int unsigned
77 */
78 public $phone_type_id;
79
80 /**
81 * Which type of IM Provider does this name belong.
82 *
83 * @var int unsigned
84 */
85 public $im_provider_id;
86
87 /**
88 * Which type of website does this site belong
89 *
90 * @var int unsigned
91 */
92 public $website_type_id;
93
94 /**
95 * Relationship type, if required
96 *
97 * @var int unsigned
98 */
99 public $relationship_type_id;
100
101 /**
102 * @var string
103 */
104 public $relationship_direction;
105
106 /**
107 * Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
108 mappings).
109 *
110 * @var int unsigned
111 */
112 public $grouping;
113
114 /**
115 * SQL WHERE operator for search-builder mapping fields (search criteria).
116 *
117 * @var string
118 */
119 public $operator;
120
121 /**
122 * SQL WHERE value for search-builder mapping fields.
123 *
124 * @var string
125 */
126 public $value;
127
128 /**
129 * Class constructor.
130 */
131 public function __construct() {
132 $this->__table = 'civicrm_mapping_field';
133 parent::__construct();
134 }
135
136 /**
137 * Returns foreign keys and entity references.
138 *
139 * @return array
140 * [CRM_Core_Reference_Interface]
141 */
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']);
149 }
150 return Civi::$statics[__CLASS__]['links'];
151 }
152
153 /**
154 * Returns all the column names of this table
155 *
156 * @return array
157 */
158 public static function &fields() {
159 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
160 Civi::$statics[__CLASS__]['fields'] = [
161 'id' => [
162 'name' => 'id',
163 'type' => CRM_Utils_Type::T_INT,
164 'title' => ts('Mapping Field ID'),
165 'description' => ts('Mapping Field ID'),
166 'required' => TRUE,
167 'table_name' => 'civicrm_mapping_field',
168 'entity' => 'MappingField',
169 'bao' => 'CRM_Core_DAO_MappingField',
170 'localizable' => 0,
171 ],
172 'mapping_id' => [
173 'name' => 'mapping_id',
174 'type' => CRM_Utils_Type::T_INT,
175 'title' => ts('Mapping ID'),
176 'description' => ts('Mapping to which this field belongs'),
177 'required' => TRUE,
178 'table_name' => 'civicrm_mapping_field',
179 'entity' => 'MappingField',
180 'bao' => 'CRM_Core_DAO_MappingField',
181 'localizable' => 0,
182 'FKClassName' => 'CRM_Core_DAO_Mapping',
183 ],
184 'name' => [
185 'name' => 'name',
186 'type' => CRM_Utils_Type::T_STRING,
187 'title' => ts('Name'),
188 'description' => ts('Mapping field key'),
189 'maxlength' => 255,
190 'size' => CRM_Utils_Type::HUGE,
191 'table_name' => 'civicrm_mapping_field',
192 'entity' => 'MappingField',
193 'bao' => 'CRM_Core_DAO_MappingField',
194 'localizable' => 0,
195 ],
196 'contact_type' => [
197 'name' => 'contact_type',
198 'type' => CRM_Utils_Type::T_STRING,
199 'title' => ts('Contact Type'),
200 'description' => ts('Contact Type in mapping'),
201 'maxlength' => 64,
202 'size' => CRM_Utils_Type::BIG,
203 'table_name' => 'civicrm_mapping_field',
204 'entity' => 'MappingField',
205 'bao' => 'CRM_Core_DAO_MappingField',
206 'localizable' => 0,
207 'html' => [
208 'type' => 'Select',
209 ],
210 ],
211 'column_number' => [
212 'name' => 'column_number',
213 'type' => CRM_Utils_Type::T_INT,
214 'title' => ts('Column Number'),
215 'description' => ts('Column number for mapping set'),
216 'required' => TRUE,
217 'table_name' => 'civicrm_mapping_field',
218 'entity' => 'MappingField',
219 'bao' => 'CRM_Core_DAO_MappingField',
220 'localizable' => 0,
221 ],
222 'location_type_id' => [
223 'name' => 'location_type_id',
224 'type' => CRM_Utils_Type::T_INT,
225 'title' => ts('Location type ID'),
226 'description' => ts('Location type of this mapping, if required'),
227 'table_name' => 'civicrm_mapping_field',
228 'entity' => 'MappingField',
229 'bao' => 'CRM_Core_DAO_MappingField',
230 'localizable' => 0,
231 'FKClassName' => 'CRM_Core_DAO_LocationType',
232 ],
233 'phone_type_id' => [
234 'name' => 'phone_type_id',
235 'type' => CRM_Utils_Type::T_INT,
236 'title' => ts('Phone type ID'),
237 'description' => ts('Which type of phone does this number belongs.'),
238 'table_name' => 'civicrm_mapping_field',
239 'entity' => 'MappingField',
240 'bao' => 'CRM_Core_DAO_MappingField',
241 'localizable' => 0,
242 ],
243 'im_provider_id' => [
244 'name' => 'im_provider_id',
245 'type' => CRM_Utils_Type::T_INT,
246 'title' => ts('IM provider ID'),
247 'description' => ts('Which type of IM Provider does this name belong.'),
248 'table_name' => 'civicrm_mapping_field',
249 'entity' => 'MappingField',
250 'bao' => 'CRM_Core_DAO_MappingField',
251 'localizable' => 0,
252 'html' => [
253 'type' => 'Select',
254 ],
255 'pseudoconstant' => [
256 'optionGroupName' => 'instant_messenger_service',
257 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
258 ]
259 ],
260 'website_type_id' => [
261 'name' => 'website_type_id',
262 'type' => CRM_Utils_Type::T_INT,
263 'title' => ts('Website type ID'),
264 'description' => ts('Which type of website does this site belong'),
265 'table_name' => 'civicrm_mapping_field',
266 'entity' => 'MappingField',
267 'bao' => 'CRM_Core_DAO_MappingField',
268 'localizable' => 0,
269 'html' => [
270 'type' => 'Select',
271 ],
272 'pseudoconstant' => [
273 'optionGroupName' => 'website_type',
274 'optionEditPath' => 'civicrm/admin/options/website_type',
275 ]
276 ],
277 'relationship_type_id' => [
278 'name' => 'relationship_type_id',
279 'type' => CRM_Utils_Type::T_INT,
280 'title' => ts('Relationship type ID'),
281 'description' => ts('Relationship type, if required'),
282 'table_name' => 'civicrm_mapping_field',
283 'entity' => 'MappingField',
284 'bao' => 'CRM_Core_DAO_MappingField',
285 'localizable' => 0,
286 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
287 ],
288 'relationship_direction' => [
289 'name' => 'relationship_direction',
290 'type' => CRM_Utils_Type::T_STRING,
291 'title' => ts('Relationship Direction'),
292 'maxlength' => 6,
293 'size' => CRM_Utils_Type::SIX,
294 'table_name' => 'civicrm_mapping_field',
295 'entity' => 'MappingField',
296 'bao' => 'CRM_Core_DAO_MappingField',
297 'localizable' => 0,
298 ],
299 'grouping' => [
300 'name' => 'grouping',
301 'type' => CRM_Utils_Type::T_INT,
302 'title' => ts('Grouping'),
303 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
304 mappings).
305 '),
306 'default' => '1',
307 'table_name' => 'civicrm_mapping_field',
308 'entity' => 'MappingField',
309 'bao' => 'CRM_Core_DAO_MappingField',
310 'localizable' => 0,
311 ],
312 'operator' => [
313 'name' => 'operator',
314 'type' => CRM_Utils_Type::T_STRING,
315 'title' => ts('Operator'),
316 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'),
317 'maxlength' => 16,
318 'size' => CRM_Utils_Type::TWELVE,
319 'table_name' => 'civicrm_mapping_field',
320 'entity' => 'MappingField',
321 'bao' => 'CRM_Core_DAO_MappingField',
322 'localizable' => 0,
323 'html' => [
324 'type' => 'Select',
325 ],
326 'pseudoconstant' => [
327 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
328 ]
329 ],
330 'value' => [
331 'name' => 'value',
332 'type' => CRM_Utils_Type::T_STRING,
333 'title' => ts('Value'),
334 'description' => ts('SQL WHERE value for search-builder mapping fields.'),
335 'maxlength' => 255,
336 'size' => CRM_Utils_Type::HUGE,
337 'table_name' => 'civicrm_mapping_field',
338 'entity' => 'MappingField',
339 'bao' => 'CRM_Core_DAO_MappingField',
340 'localizable' => 0,
341 ],
342 ];
343 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
344 }
345 return Civi::$statics[__CLASS__]['fields'];
346 }
347
348 /**
349 * Return a mapping from field-name to the corresponding key (as used in fields()).
350 *
351 * @return array
352 * Array(string $name => string $uniqueName).
353 */
354 public static function &fieldKeys() {
355 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
356 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
357 }
358 return Civi::$statics[__CLASS__]['fieldKeys'];
359 }
360
361 /**
362 * Returns the names of this table
363 *
364 * @return string
365 */
366 public static function getTableName() {
367 return self::$_tableName;
368 }
369
370 /**
371 * Returns if this table needs to be logged
372 *
373 * @return bool
374 */
375 public function getLog() {
376 return self::$_log;
377 }
378
379 /**
380 * Returns the list of fields that can be imported
381 *
382 * @param bool $prefix
383 *
384 * @return array
385 */
386 public static function &import($prefix = FALSE) {
387 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping_field', $prefix, []);
388 return $r;
389 }
390
391 /**
392 * Returns the list of fields that can be exported
393 *
394 * @param bool $prefix
395 *
396 * @return array
397 */
398 public static function &export($prefix = FALSE) {
399 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping_field', $prefix, []);
400 return $r;
401 }
402
403 /**
404 * Returns the list of indices
405 *
406 * @param bool $localize
407 *
408 * @return array
409 */
410 public static function indices($localize = TRUE) {
411 $indices = [];
412 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
413 }
414
415 }