fixup CRM-14885 - Import DAOs
[civicrm-core.git] / CRM / Contact / DAO / Relationship.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/Contact/Relationship.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:935010ec18927fdebfa19965f5f73b48)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Contact_DAO_Relationship extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_relationship';
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 = true;
83 /**
84 * Relationship ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * id of the first contact
91 *
92 * @var int unsigned
93 */
94 public $contact_id_a;
95 /**
96 * id of the second contact
97 *
98 * @var int unsigned
99 */
100 public $contact_id_b;
101 /**
102 * id of the relationship
103 *
104 * @var int unsigned
105 */
106 public $relationship_type_id;
107 /**
108 * date when the relationship started
109 *
110 * @var date
111 */
112 public $start_date;
113 /**
114 * date when the relationship ended
115 *
116 * @var date
117 */
118 public $end_date;
119 /**
120 * is the relationship active ?
121 *
122 * @var boolean
123 */
124 public $is_active;
125 /**
126 * Optional verbose description for the relationship.
127 *
128 * @var string
129 */
130 public $description;
131 /**
132 * is contact a has permission to view / edit contact and
133 related data for contact b ?
134 *
135 * @var boolean
136 */
137 public $is_permission_a_b;
138 /**
139 * is contact b has permission to view / edit contact and
140 related data for contact a ?
141 *
142 * @var boolean
143 */
144 public $is_permission_b_a;
145 /**
146 * FK to civicrm_case
147 *
148 * @var int unsigned
149 */
150 public $case_id;
151 /**
152 * class constructor
153 *
154 * @return civicrm_relationship
155 */
156 function __construct() {
157 $this->__table = 'civicrm_relationship';
158 parent::__construct();
159 }
160 /**
161 * Returns foreign keys and entity references
162 *
163 * @return array
164 * [CRM_Core_Reference_Interface]
165 */
166 static function getReferenceColumns() {
167 if (!self::$_links) {
168 self::$_links = static ::createReferenceColumns(__CLASS__);
169 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id_a', 'civicrm_contact', 'id');
170 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id_b', 'civicrm_contact', 'id');
171 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'relationship_type_id', 'civicrm_relationship_type', 'id');
172 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'case_id', 'civicrm_case', 'id');
173 }
174 return self::$_links;
175 }
176 /**
177 * Returns all the column names of this table
178 *
179 * @return array
180 */
181 static function &fields() {
182 if (!(self::$_fields)) {
183 self::$_fields = array(
184 'id' => array(
185 'name' => 'id',
186 'type' => CRM_Utils_Type::T_INT,
187 'title' => ts('Relationship ID') ,
188 'description' => 'Relationship ID',
189 'required' => true,
190 ) ,
191 'contact_id_a' => array(
192 'name' => 'contact_id_a',
193 'type' => CRM_Utils_Type::T_INT,
194 'title' => ts('Contact A') ,
195 'description' => 'id of the first contact',
196 'required' => true,
197 'FKClassName' => 'CRM_Contact_DAO_Contact',
198 ) ,
199 'contact_id_b' => array(
200 'name' => 'contact_id_b',
201 'type' => CRM_Utils_Type::T_INT,
202 'title' => ts('Contact B') ,
203 'description' => 'id of the second contact',
204 'required' => true,
205 'FKClassName' => 'CRM_Contact_DAO_Contact',
206 'html' => array(
207 'type' => 'EntityRef',
208 ) ,
209 ) ,
210 'relationship_type_id' => array(
211 'name' => 'relationship_type_id',
212 'type' => CRM_Utils_Type::T_INT,
213 'title' => ts('Relationship Type') ,
214 'description' => 'id of the relationship',
215 'required' => true,
216 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
217 'html' => array(
218 'type' => 'Select',
219 ) ,
220 ) ,
221 'start_date' => array(
222 'name' => 'start_date',
223 'type' => CRM_Utils_Type::T_DATE,
224 'title' => ts('Relationship Start Date') ,
225 'description' => 'date when the relationship started',
226 'html' => array(
227 'type' => 'Select Date',
228 ) ,
229 ) ,
230 'end_date' => array(
231 'name' => 'end_date',
232 'type' => CRM_Utils_Type::T_DATE,
233 'title' => ts('Relationship End Date') ,
234 'description' => 'date when the relationship ended',
235 'html' => array(
236 'type' => 'Select Date',
237 ) ,
238 ) ,
239 'is_active' => array(
240 'name' => 'is_active',
241 'type' => CRM_Utils_Type::T_BOOLEAN,
242 'title' => ts('Relationship Is Active') ,
243 'description' => 'is the relationship active ?',
244 'default' => '1',
245 'html' => array(
246 'type' => 'CheckBox',
247 ) ,
248 ) ,
249 'description' => array(
250 'name' => 'description',
251 'type' => CRM_Utils_Type::T_STRING,
252 'title' => ts('Relationship Description') ,
253 'description' => 'Optional verbose description for the relationship.',
254 'maxlength' => 255,
255 'size' => CRM_Utils_Type::HUGE,
256 'html' => array(
257 'type' => 'Text',
258 ) ,
259 ) ,
260 'is_permission_a_b' => array(
261 'name' => 'is_permission_a_b',
262 'type' => CRM_Utils_Type::T_BOOLEAN,
263 'title' => ts('Contact A has Permission Over Contact B') ,
264 'description' => 'is contact a has permission to view / edit contact and
265 related data for contact b ?
266 ',
267 'html' => array(
268 'type' => 'CheckBox',
269 ) ,
270 ) ,
271 'is_permission_b_a' => array(
272 'name' => 'is_permission_b_a',
273 'type' => CRM_Utils_Type::T_BOOLEAN,
274 'title' => ts('Contact B has Permission Over Contact A') ,
275 'description' => 'is contact b has permission to view / edit contact and
276 related data for contact a ?
277 ',
278 'html' => array(
279 'type' => 'CheckBox',
280 ) ,
281 ) ,
282 'case_id' => array(
283 'name' => 'case_id',
284 'type' => CRM_Utils_Type::T_INT,
285 'title' => ts('Relationship Case') ,
286 'description' => 'FK to civicrm_case',
287 'default' => 'NULL',
288 'FKClassName' => 'CRM_Case_DAO_Case',
289 ) ,
290 );
291 }
292 return self::$_fields;
293 }
294 /**
295 * Returns an array containing, for each field, the arary key used for that
296 * field in self::$_fields.
297 *
298 * @return array
299 */
300 static function &fieldKeys() {
301 if (!(self::$_fieldKeys)) {
302 self::$_fieldKeys = array(
303 'id' => 'id',
304 'contact_id_a' => 'contact_id_a',
305 'contact_id_b' => 'contact_id_b',
306 'relationship_type_id' => 'relationship_type_id',
307 'start_date' => 'start_date',
308 'end_date' => 'end_date',
309 'is_active' => 'is_active',
310 'description' => 'description',
311 'is_permission_a_b' => 'is_permission_a_b',
312 'is_permission_b_a' => 'is_permission_b_a',
313 'case_id' => 'case_id',
314 );
315 }
316 return self::$_fieldKeys;
317 }
318 /**
319 * Returns the names of this table
320 *
321 * @return string
322 */
323 static function getTableName() {
324 return self::$_tableName;
325 }
326 /**
327 * Returns if this table needs to be logged
328 *
329 * @return boolean
330 */
331 function getLog() {
332 return self::$_log;
333 }
334 /**
335 * Returns the list of fields that can be imported
336 *
337 * @param bool $prefix
338 *
339 * @return array
340 */
341 static function &import($prefix = false) {
342 if (!(self::$_import)) {
343 self::$_import = array();
344 $fields = self::fields();
345 foreach($fields as $name => $field) {
346 if (CRM_Utils_Array::value('import', $field)) {
347 if ($prefix) {
348 self::$_import['relationship'] = & $fields[$name];
349 } else {
350 self::$_import[$name] = & $fields[$name];
351 }
352 }
353 }
354 }
355 return self::$_import;
356 }
357 /**
358 * Returns the list of fields that can be exported
359 *
360 * @param bool $prefix
361 *
362 * @return array
363 */
364 static function &export($prefix = false) {
365 if (!(self::$_export)) {
366 self::$_export = array();
367 $fields = self::fields();
368 foreach($fields as $name => $field) {
369 if (CRM_Utils_Array::value('export', $field)) {
370 if ($prefix) {
371 self::$_export['relationship'] = & $fields[$name];
372 } else {
373 self::$_export[$name] = & $fields[$name];
374 }
375 }
376 }
377 }
378 return self::$_export;
379 }
380 }