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