Fix comments on DAO files
[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:1488c12897446c8720328c904584442e)
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 ) ,
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 );
294 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
295 }
296 return Civi::$statics[__CLASS__]['fields'];
297 }
298 /**
299 * Return a mapping from field-name to the corresponding key (as used in fields()).
300 *
301 * @return array
302 * Array(string $name => string $uniqueName).
303 */
304 static function &fieldKeys() {
305 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
306 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
307 }
308 return Civi::$statics[__CLASS__]['fieldKeys'];
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) {
334 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping_field', $prefix, array());
335 return $r;
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) {
345 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping_field', $prefix, array());
346 return $r;
347 }
348 }