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