Add comment blocks
[civicrm-core.git] / CRM / Core / DAO / MappingField.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
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
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Core/MappingField.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:1488c12897446c8720328c904584442e)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class 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';
e501603b
TO
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = false;
51 /**
52 * Mapping Field ID
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * Mapping to which this field belongs
59 *
60 * @var int unsigned
61 */
62 public $mapping_id;
63 /**
64 * Mapping field key
65 *
66 * @var string
67 */
68 public $name;
69 /**
70 * Contact Type in mapping
71 *
72 * @var string
73 */
74 public $contact_type;
75 /**
76 * Column number for mapping set
77 *
78 * @var int unsigned
79 */
80 public $column_number;
81 /**
82 * Location type of this mapping, if required
83 *
84 * @var int unsigned
85 */
86 public $location_type_id;
87 /**
88 * Which type of phone does this number belongs.
89 *
90 * @var int unsigned
91 */
92 public $phone_type_id;
93 /**
94 * Which type of IM Provider does this name belong.
95 *
96 * @var int unsigned
97 */
98 public $im_provider_id;
99 /**
100 * Which type of website does this site belong
101 *
102 * @var int unsigned
103 */
104 public $website_type_id;
105 /**
106 * Relationship type, if required
107 *
108 * @var int unsigned
109 */
110 public $relationship_type_id;
111 /**
112 *
113 * @var string
114 */
115 public $relationship_direction;
116 /**
117 * Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
118 mappings).
119 *
120 * @var int unsigned
121 */
122 public $grouping;
123 /**
124 * SQL WHERE operator for search-builder mapping fields (search criteria).
125 *
126 * @var string
127 */
128 public $operator;
129 /**
130 * SQL WHERE value for search-builder mapping fields.
131 *
132 * @var string
133 */
134 public $value;
135 /**
136 * class constructor
137 *
138 * @return civicrm_mapping_field
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() {
346aaaba
TO
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']);
e501603b 157 }
346aaaba 158 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
159 }
160 /**
161 * Returns all the column names of this table
162 *
163 * @return array
164 */
165 static function &fields() {
346aaaba
TO
166 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
167 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
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 ) ,
175 'mapping_id' => array(
176 'name' => 'mapping_id',
177 'type' => CRM_Utils_Type::T_INT,
178 'title' => ts('Mapping ID') ,
179 'description' => 'Mapping to which this field belongs',
180 'required' => true,
181 'FKClassName' => 'CRM_Core_DAO_Mapping',
182 ) ,
183 'name' => array(
184 'name' => 'name',
185 'type' => CRM_Utils_Type::T_STRING,
186 'title' => ts('Name') ,
187 'description' => 'Mapping field key',
188 'maxlength' => 255,
189 'size' => CRM_Utils_Type::HUGE,
190 ) ,
191 'contact_type' => array(
192 'name' => 'contact_type',
193 'type' => CRM_Utils_Type::T_STRING,
194 'title' => ts('Contact Type') ,
195 'description' => 'Contact Type in mapping',
196 'maxlength' => 64,
197 'size' => CRM_Utils_Type::BIG,
198 'html' => array(
199 'type' => 'Select',
200 ) ,
201 ) ,
202 'column_number' => array(
203 'name' => 'column_number',
204 'type' => CRM_Utils_Type::T_INT,
205 'title' => ts('Column Number') ,
206 'description' => 'Column number for mapping set',
207 'required' => true,
208 ) ,
209 'location_type_id' => array(
210 'name' => 'location_type_id',
211 'type' => CRM_Utils_Type::T_INT,
212 'title' => ts('Location type ID') ,
213 'description' => 'Location type of this mapping, if required',
214 'FKClassName' => 'CRM_Core_DAO_LocationType',
215 ) ,
216 'phone_type_id' => array(
217 'name' => 'phone_type_id',
218 'type' => CRM_Utils_Type::T_INT,
219 'title' => ts('Phone type ID') ,
220 'description' => 'Which type of phone does this number belongs.',
221 ) ,
222 'im_provider_id' => array(
223 'name' => 'im_provider_id',
224 'type' => CRM_Utils_Type::T_INT,
225 'title' => ts('IM provider ID') ,
226 'description' => 'Which type of IM Provider does this name belong.',
227 'html' => array(
228 'type' => 'Select',
229 ) ,
230 'pseudoconstant' => array(
231 'optionGroupName' => 'instant_messenger_service',
232 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
233 )
234 ) ,
235 'website_type_id' => array(
236 'name' => 'website_type_id',
237 'type' => CRM_Utils_Type::T_INT,
238 'title' => ts('Website type ID') ,
239 'description' => 'Which type of website does this site belong',
240 'html' => array(
241 'type' => 'Select',
242 ) ,
243 'pseudoconstant' => array(
244 'optionGroupName' => 'website_type',
245 'optionEditPath' => 'civicrm/admin/options/website_type',
246 )
247 ) ,
248 'relationship_type_id' => array(
249 'name' => 'relationship_type_id',
250 'type' => CRM_Utils_Type::T_INT,
251 'title' => ts('Relationship type ID') ,
252 'description' => 'Relationship type, if required',
253 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
254 ) ,
255 'relationship_direction' => array(
256 'name' => 'relationship_direction',
257 'type' => CRM_Utils_Type::T_STRING,
258 'title' => ts('Relationship Direction') ,
259 'maxlength' => 6,
260 'size' => CRM_Utils_Type::SIX,
261 ) ,
262 'grouping' => array(
263 'name' => 'grouping',
264 'type' => CRM_Utils_Type::T_INT,
265 'title' => ts('Grouping') ,
266 'description' => 'Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
267 mappings).
268 ',
269 'default' => '1',
270 ) ,
271 'operator' => array(
272 'name' => 'operator',
273 'type' => CRM_Utils_Type::T_STRING,
274 'title' => ts('Operator') ,
275 'description' => 'SQL WHERE operator for search-builder mapping fields (search criteria).',
276 'maxlength' => 16,
277 'size' => CRM_Utils_Type::TWELVE,
278 'html' => array(
279 'type' => 'Select',
280 ) ,
281 'pseudoconstant' => array(
282 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
283 )
284 ) ,
285 'value' => array(
286 'name' => 'value',
287 'type' => CRM_Utils_Type::T_STRING,
288 'title' => ts('Value') ,
289 'description' => 'SQL WHERE value for search-builder mapping fields.',
290 'maxlength' => 255,
291 'size' => CRM_Utils_Type::HUGE,
292 ) ,
293 );
346aaaba 294 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 295 }
346aaaba 296 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
297 }
298 /**
bd8e0b14 299 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
300 *
301 * @return array
bd8e0b14 302 * Array(string $name => string $uniqueName).
e501603b
TO
303 */
304 static function &fieldKeys() {
bd8e0b14
TO
305 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
306 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 307 }
bd8e0b14 308 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
309 }
310 /**
311 * Returns the names of this table
312 *
313 * @return string
314 */
315 static function getTableName() {
316 return self::$_tableName;
317 }
318 /**
319 * Returns if this table needs to be logged
320 *
321 * @return boolean
322 */
323 function getLog() {
324 return self::$_log;
325 }
326 /**
327 * Returns the list of fields that can be imported
328 *
329 * @param bool $prefix
330 *
331 * @return array
332 */
333 static function &import($prefix = false) {
60808919
TO
334 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping_field', $prefix, array());
335 return $r;
e501603b
TO
336 }
337 /**
338 * Returns the list of fields that can be exported
339 *
340 * @param bool $prefix
341 *
342 * @return array
343 */
344 static function &export($prefix = false) {
60808919
TO
345 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping_field', $prefix, array());
346 return $r;
e501603b
TO
347 }
348}