CRM-14885 - Import DAO's
[civicrm-core.git] / CRM / Core / DAO / MappingField.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Core/MappingField.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:3d48f11ca4d7d7bfbfa9125745b0f3e1)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Core_DAO_MappingField extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_mapping_field';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = false;
83 /**
84 * Mapping Field ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * Mapping to which this field belongs
91 *
92 * @var int unsigned
93 */
94 public $mapping_id;
95 /**
96 * Mapping field key
97 *
98 * @var string
99 */
100 public $name;
101 /**
102 * Contact Type in mapping
103 *
104 * @var string
105 */
106 public $contact_type;
107 /**
108 * Column number for mapping set
109 *
110 * @var int unsigned
111 */
112 public $column_number;
113 /**
114 * Location type of this mapping, if required
115 *
116 * @var int unsigned
117 */
118 public $location_type_id;
119 /**
120 * Which type of phone does this number belongs.
121 *
122 * @var int unsigned
123 */
124 public $phone_type_id;
125 /**
126 * Which type of IM Provider does this name belong.
127 *
128 * @var int unsigned
129 */
130 public $im_provider_id;
131 /**
132 * Which type of website does this site belong
133 *
134 * @var int unsigned
135 */
136 public $website_type_id;
137 /**
138 * Relationship type, if required
139 *
140 * @var int unsigned
141 */
142 public $relationship_type_id;
143 /**
144 *
145 * @var string
146 */
147 public $relationship_direction;
148 /**
149 * Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
150 mappings).
151 *
152 * @var int unsigned
153 */
154 public $grouping;
155 /**
156 * SQL WHERE operator for search-builder mapping fields (search criteria).
157 *
158 * @var string
159 */
160 public $operator;
161 /**
162 * SQL WHERE value for search-builder mapping fields.
163 *
164 * @var string
165 */
166 public $value;
167 /**
168 * class constructor
169 *
170 * @return civicrm_mapping_field
171 */
172 function __construct() {
173 $this->__table = 'civicrm_mapping_field';
174 parent::__construct();
175 }
176 /**
177 * Returns foreign keys and entity references
178 *
179 * @return array
180 * [CRM_Core_Reference_Interface]
181 */
182 static function getReferenceColumns() {
183 if (!self::$_links) {
184 self::$_links = static ::createReferenceColumns(__CLASS__);
185 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'mapping_id', 'civicrm_mapping', 'id');
186 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_type_id', 'civicrm_location_type', 'id');
187 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'relationship_type_id', 'civicrm_relationship_type', 'id');
188 }
189 return self::$_links;
190 }
191 /**
192 * Returns all the column names of this table
193 *
194 * @return array
195 */
196 static function &fields() {
197 if (!(self::$_fields)) {
198 self::$_fields = array(
199 'id' => array(
200 'name' => 'id',
201 'type' => CRM_Utils_Type::T_INT,
202 'title' => ts('Mapping Field ID') ,
203 'description' => 'Mapping Field ID',
204 'required' => true,
205 ) ,
206 'mapping_id' => array(
207 'name' => 'mapping_id',
208 'type' => CRM_Utils_Type::T_INT,
209 'title' => ts('Mapping ID') ,
210 'description' => 'Mapping to which this field belongs',
211 'required' => true,
212 'FKClassName' => 'CRM_Core_DAO_Mapping',
213 ) ,
214 'name' => array(
215 'name' => 'name',
216 'type' => CRM_Utils_Type::T_STRING,
217 'title' => ts('Name') ,
218 'description' => 'Mapping field key',
219 'maxlength' => 255,
220 'size' => CRM_Utils_Type::HUGE,
221 ) ,
222 'contact_type' => array(
223 'name' => 'contact_type',
224 'type' => CRM_Utils_Type::T_STRING,
225 'title' => ts('Contact Type') ,
226 'description' => 'Contact Type in mapping',
227 'maxlength' => 64,
228 'size' => CRM_Utils_Type::BIG,
229 'html' => array(
230 'type' => 'Select',
231 ) ,
232 ) ,
233 'column_number' => array(
234 'name' => 'column_number',
235 'type' => CRM_Utils_Type::T_INT,
236 'title' => ts('Column Number') ,
237 'description' => 'Column number for mapping set',
238 'required' => true,
239 ) ,
240 'location_type_id' => array(
241 'name' => 'location_type_id',
242 'type' => CRM_Utils_Type::T_INT,
243 'title' => ts('Location type ID') ,
244 'description' => 'Location type of this mapping, if required',
245 'FKClassName' => 'CRM_Core_DAO_LocationType',
246 ) ,
247 'phone_type_id' => array(
248 'name' => 'phone_type_id',
249 'type' => CRM_Utils_Type::T_INT,
250 'title' => ts('Phone type ID') ,
251 'description' => 'Which type of phone does this number belongs.',
252 ) ,
253 'im_provider_id' => array(
254 'name' => 'im_provider_id',
255 'type' => CRM_Utils_Type::T_INT,
256 'title' => ts('IM provider ID') ,
257 'description' => 'Which type of IM Provider does this name belong.',
258 'html' => array(
259 'type' => 'Select',
260 ) ,
261 'pseudoconstant' => array(
262 'optionGroupName' => 'instant_messenger_service',
263 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
264 )
265 ) ,
266 'website_type_id' => array(
267 'name' => 'website_type_id',
268 'type' => CRM_Utils_Type::T_INT,
269 'title' => ts('Website type ID') ,
270 'description' => 'Which type of website does this site belong',
271 'html' => array(
272 'type' => 'Select',
273 ) ,
274 'pseudoconstant' => array(
275 'optionGroupName' => 'website_type',
276 'optionEditPath' => 'civicrm/admin/options/website_type',
277 )
278 ) ,
279 'relationship_type_id' => array(
280 'name' => 'relationship_type_id',
281 'type' => CRM_Utils_Type::T_INT,
282 'title' => ts('Relationship type ID') ,
283 'description' => 'Relationship type, if required',
284 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
285 ) ,
286 'relationship_direction' => array(
287 'name' => 'relationship_direction',
288 'type' => CRM_Utils_Type::T_STRING,
289 'title' => ts('Relationship Direction') ,
290 'maxlength' => 6,
291 'size' => CRM_Utils_Type::SIX,
292 ) ,
293 'grouping' => array(
294 'name' => 'grouping',
295 'type' => CRM_Utils_Type::T_INT,
296 'title' => ts('Grouping') ,
297 'description' => 'Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
298 mappings).
299 ',
300 'default' => '1',
301 ) ,
302 'operator' => array(
303 'name' => 'operator',
304 'type' => CRM_Utils_Type::T_STRING,
305 'title' => ts('Operator') ,
306 'description' => 'SQL WHERE operator for search-builder mapping fields (search criteria).',
307 'maxlength' => 16,
308 'size' => CRM_Utils_Type::TWELVE,
309 'html' => array(
310 'type' => 'Select',
311 ) ,
312 'pseudoconstant' => array(
313 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
314 )
315 ) ,
316 'value' => array(
317 'name' => 'value',
318 'type' => CRM_Utils_Type::T_STRING,
319 'title' => ts('Value') ,
320 'description' => 'SQL WHERE value for search-builder mapping fields.',
321 'maxlength' => 255,
322 'size' => CRM_Utils_Type::HUGE,
323 ) ,
324 );
325 }
326 return self::$_fields;
327 }
328 /**
329 * Returns an array containing, for each field, the arary key used for that
330 * field in self::$_fields.
331 *
332 * @return array
333 */
334 static function &fieldKeys() {
335 if (!(self::$_fieldKeys)) {
336 self::$_fieldKeys = array(
337 'id' => 'id',
338 'mapping_id' => 'mapping_id',
339 'name' => 'name',
340 'contact_type' => 'contact_type',
341 'column_number' => 'column_number',
342 'location_type_id' => 'location_type_id',
343 'phone_type_id' => 'phone_type_id',
344 'im_provider_id' => 'im_provider_id',
345 'website_type_id' => 'website_type_id',
346 'relationship_type_id' => 'relationship_type_id',
347 'relationship_direction' => 'relationship_direction',
348 'grouping' => 'grouping',
349 'operator' => 'operator',
350 'value' => 'value',
351 );
352 }
353 return self::$_fieldKeys;
354 }
355 /**
356 * Returns the names of this table
357 *
358 * @return string
359 */
360 static function getTableName() {
361 return self::$_tableName;
362 }
363 /**
364 * Returns if this table needs to be logged
365 *
366 * @return boolean
367 */
368 function getLog() {
369 return self::$_log;
370 }
371 /**
372 * Returns the list of fields that can be imported
373 *
374 * @param bool $prefix
375 *
376 * @return array
377 */
378 static function &import($prefix = false) {
379 if (!(self::$_import)) {
380 self::$_import = array();
381 $fields = self::fields();
382 foreach($fields as $name => $field) {
383 if (CRM_Utils_Array::value('import', $field)) {
384 if ($prefix) {
385 self::$_import['mapping_field'] = & $fields[$name];
386 } else {
387 self::$_import[$name] = & $fields[$name];
388 }
389 }
390 }
391 }
392 return self::$_import;
393 }
394 /**
395 * Returns the list of fields that can be exported
396 *
397 * @param bool $prefix
398 *
399 * @return array
400 */
401 static function &export($prefix = false) {
402 if (!(self::$_export)) {
403 self::$_export = array();
404 $fields = self::fields();
405 foreach($fields as $name => $field) {
406 if (CRM_Utils_Array::value('export', $field)) {
407 if ($prefix) {
408 self::$_export['mapping_field'] = & $fields[$name];
409 } else {
410 self::$_export[$name] = & $fields[$name];
411 }
412 }
413 }
414 }
415 return self::$_export;
416 }
417 }