Commit | Line | Data |
---|---|---|
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/Contact/RelationshipType.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
522a26c9 | 33 | * (GenCodeChecksum:fd2114d6f9d64c68e710c21230e73c5f) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Contact_DAO_RelationshipType constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO { |
41 | /** | |
f41f0342 | 42 | * Static instance to hold the table name. |
e501603b TO |
43 | * |
44 | * @var string | |
45 | */ | |
46 | static $_tableName = 'civicrm_relationship_type'; | |
e501603b | 47 | /** |
f41f0342 | 48 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b TO |
49 | * |
50 | * @var boolean | |
51 | */ | |
52 | static $_log = true; | |
53 | /** | |
54 | * Primary key | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * name for relationship of contact_a to contact_b. | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $name_a_b; | |
65 | /** | |
66 | * label for relationship of contact_a to contact_b. | |
67 | * | |
68 | * @var string | |
69 | */ | |
70 | public $label_a_b; | |
71 | /** | |
72 | * Optional name for relationship of contact_b to contact_a. | |
73 | * | |
74 | * @var string | |
75 | */ | |
76 | public $name_b_a; | |
77 | /** | |
78 | * Optional label for relationship of contact_b to contact_a. | |
79 | * | |
80 | * @var string | |
81 | */ | |
82 | public $label_b_a; | |
83 | /** | |
84 | * Optional verbose description of the relationship type. | |
85 | * | |
86 | * @var string | |
87 | */ | |
88 | public $description; | |
89 | /** | |
90 | * If defined, contact_a in a relationship of this type must be a specific contact_type. | |
91 | * | |
92 | * @var string | |
93 | */ | |
94 | public $contact_type_a; | |
95 | /** | |
96 | * If defined, contact_b in a relationship of this type must be a specific contact_type. | |
97 | * | |
98 | * @var string | |
99 | */ | |
100 | public $contact_type_b; | |
101 | /** | |
102 | * If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type. | |
103 | * | |
104 | * @var string | |
105 | */ | |
106 | public $contact_sub_type_a; | |
107 | /** | |
108 | * If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type. | |
109 | * | |
110 | * @var string | |
111 | */ | |
112 | public $contact_sub_type_b; | |
113 | /** | |
114 | * Is this relationship type a predefined system type (can not be changed or de-activated)? | |
115 | * | |
116 | * @var boolean | |
117 | */ | |
118 | public $is_reserved; | |
119 | /** | |
120 | * Is this relationship type currently active (i.e. can be used when creating or editing relationships)? | |
121 | * | |
122 | * @var boolean | |
123 | */ | |
124 | public $is_active; | |
125 | /** | |
f41f0342 | 126 | * Class constructor. |
e501603b TO |
127 | */ |
128 | function __construct() { | |
129 | $this->__table = 'civicrm_relationship_type'; | |
130 | parent::__construct(); | |
131 | } | |
132 | /** | |
133 | * Returns all the column names of this table | |
134 | * | |
135 | * @return array | |
136 | */ | |
137 | static function &fields() { | |
346aaaba TO |
138 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
139 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
140 | 'id' => array( |
141 | 'name' => 'id', | |
142 | 'type' => CRM_Utils_Type::T_INT, | |
143 | 'title' => ts('Relationship Type ID') , | |
144 | 'description' => 'Primary key', | |
145 | 'required' => true, | |
522a26c9 | 146 | 'table_name' => 'civicrm_relationship_type', |
147 | 'entity' => 'RelationshipType', | |
148 | 'bao' => 'CRM_Contact_BAO_RelationshipType', | |
e501603b TO |
149 | ) , |
150 | 'name_a_b' => array( | |
151 | 'name' => 'name_a_b', | |
152 | 'type' => CRM_Utils_Type::T_STRING, | |
153 | 'title' => ts('Relationship Type Name A to B') , | |
154 | 'description' => 'name for relationship of contact_a to contact_b.', | |
155 | 'maxlength' => 64, | |
156 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 157 | 'table_name' => 'civicrm_relationship_type', |
158 | 'entity' => 'RelationshipType', | |
159 | 'bao' => 'CRM_Contact_BAO_RelationshipType', | |
e501603b TO |
160 | ) , |
161 | 'label_a_b' => array( | |
162 | 'name' => 'label_a_b', | |
163 | 'type' => CRM_Utils_Type::T_STRING, | |
164 | 'title' => ts('Relationship Type Label A to B') , | |
165 | 'description' => 'label for relationship of contact_a to contact_b.', | |
166 | 'maxlength' => 64, | |
167 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 168 | 'table_name' => 'civicrm_relationship_type', |
169 | 'entity' => 'RelationshipType', | |
170 | 'bao' => 'CRM_Contact_BAO_RelationshipType', | |
e501603b TO |
171 | ) , |
172 | 'name_b_a' => array( | |
173 | 'name' => 'name_b_a', | |
174 | 'type' => CRM_Utils_Type::T_STRING, | |
175 | 'title' => ts('Relationship Type Name B to A') , | |
176 | 'description' => 'Optional name for relationship of contact_b to contact_a.', | |
177 | 'maxlength' => 64, | |
178 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 179 | 'table_name' => 'civicrm_relationship_type', |
180 | 'entity' => 'RelationshipType', | |
181 | 'bao' => 'CRM_Contact_BAO_RelationshipType', | |
e501603b TO |
182 | ) , |
183 | 'label_b_a' => array( | |
184 | 'name' => 'label_b_a', | |
185 | 'type' => CRM_Utils_Type::T_STRING, | |
186 | 'title' => ts('Relationship Type Label B to A') , | |
187 | 'description' => 'Optional label for relationship of contact_b to contact_a.', | |
188 | 'maxlength' => 64, | |
189 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 190 | 'table_name' => 'civicrm_relationship_type', |
191 | 'entity' => 'RelationshipType', | |
192 | 'bao' => 'CRM_Contact_BAO_RelationshipType', | |
e501603b TO |
193 | ) , |
194 | 'description' => array( | |
195 | 'name' => 'description', | |
196 | 'type' => CRM_Utils_Type::T_STRING, | |
197 | 'title' => ts('Relationship Description') , | |
198 | 'description' => 'Optional verbose description of the relationship type.', | |
199 | 'maxlength' => 255, | |
200 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 201 | 'table_name' => 'civicrm_relationship_type', |
202 | 'entity' => 'RelationshipType', | |
203 | 'bao' => 'CRM_Contact_BAO_RelationshipType', | |
e501603b TO |
204 | ) , |
205 | 'contact_type_a' => array( | |
206 | 'name' => 'contact_type_a', | |
207 | 'type' => CRM_Utils_Type::T_STRING, | |
208 | 'title' => ts('Contact Type for Contact A') , | |
209 | 'description' => 'If defined, contact_a in a relationship of this type must be a specific contact_type.', | |
210 | 'maxlength' => 12, | |
211 | 'size' => CRM_Utils_Type::TWELVE, | |
522a26c9 | 212 | 'table_name' => 'civicrm_relationship_type', |
213 | 'entity' => 'RelationshipType', | |
214 | 'bao' => 'CRM_Contact_BAO_RelationshipType', | |
e501603b TO |
215 | 'html' => array( |
216 | 'type' => 'Select', | |
217 | ) , | |
218 | 'pseudoconstant' => array( | |
219 | 'table' => 'civicrm_contact_type', | |
220 | 'keyColumn' => 'name', | |
221 | 'labelColumn' => 'label', | |
222 | 'condition' => 'parent_id IS NULL', | |
223 | ) | |
224 | ) , | |
225 | 'contact_type_b' => array( | |
226 | 'name' => 'contact_type_b', | |
227 | 'type' => CRM_Utils_Type::T_STRING, | |
228 | 'title' => ts('Contact Type for Contact B') , | |
229 | 'description' => 'If defined, contact_b in a relationship of this type must be a specific contact_type.', | |
230 | 'maxlength' => 12, | |
231 | 'size' => CRM_Utils_Type::TWELVE, | |
522a26c9 | 232 | 'table_name' => 'civicrm_relationship_type', |
233 | 'entity' => 'RelationshipType', | |
234 | 'bao' => 'CRM_Contact_BAO_RelationshipType', | |
e501603b TO |
235 | 'html' => array( |
236 | 'type' => 'Select', | |
237 | ) , | |
238 | 'pseudoconstant' => array( | |
239 | 'table' => 'civicrm_contact_type', | |
240 | 'keyColumn' => 'name', | |
241 | 'labelColumn' => 'label', | |
242 | 'condition' => 'parent_id IS NULL', | |
243 | ) | |
244 | ) , | |
245 | 'contact_sub_type_a' => array( | |
246 | 'name' => 'contact_sub_type_a', | |
247 | 'type' => CRM_Utils_Type::T_STRING, | |
248 | 'title' => ts('Contact Subtype A') , | |
249 | 'description' => 'If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type. | |
250 | ', | |
251 | 'maxlength' => 64, | |
252 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 253 | 'table_name' => 'civicrm_relationship_type', |
254 | 'entity' => 'RelationshipType', | |
255 | 'bao' => 'CRM_Contact_BAO_RelationshipType', | |
e501603b TO |
256 | 'html' => array( |
257 | 'type' => 'Select', | |
258 | ) , | |
259 | 'pseudoconstant' => array( | |
260 | 'table' => 'civicrm_contact_type', | |
261 | 'keyColumn' => 'name', | |
262 | 'labelColumn' => 'label', | |
263 | 'condition' => 'parent_id IS NOT NULL', | |
264 | ) | |
265 | ) , | |
266 | 'contact_sub_type_b' => array( | |
267 | 'name' => 'contact_sub_type_b', | |
268 | 'type' => CRM_Utils_Type::T_STRING, | |
269 | 'title' => ts('Contact Subtype B') , | |
270 | 'description' => 'If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type. | |
271 | ', | |
272 | 'maxlength' => 64, | |
273 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 274 | 'table_name' => 'civicrm_relationship_type', |
275 | 'entity' => 'RelationshipType', | |
276 | 'bao' => 'CRM_Contact_BAO_RelationshipType', | |
e501603b TO |
277 | 'html' => array( |
278 | 'type' => 'Select', | |
279 | ) , | |
280 | 'pseudoconstant' => array( | |
281 | 'table' => 'civicrm_contact_type', | |
282 | 'keyColumn' => 'name', | |
283 | 'labelColumn' => 'label', | |
284 | 'condition' => 'parent_id IS NOT NULL', | |
285 | ) | |
286 | ) , | |
287 | 'is_reserved' => array( | |
288 | 'name' => 'is_reserved', | |
289 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
290 | 'title' => ts('Relationship Type is Reserved') , | |
291 | 'description' => 'Is this relationship type a predefined system type (can not be changed or de-activated)?', | |
522a26c9 | 292 | 'table_name' => 'civicrm_relationship_type', |
293 | 'entity' => 'RelationshipType', | |
294 | 'bao' => 'CRM_Contact_BAO_RelationshipType', | |
e501603b TO |
295 | ) , |
296 | 'is_active' => array( | |
297 | 'name' => 'is_active', | |
298 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
299 | 'title' => ts('Relationship Type is Active') , | |
300 | 'description' => 'Is this relationship type currently active (i.e. can be used when creating or editing relationships)? | |
301 | ', | |
302 | 'default' => '1', | |
522a26c9 | 303 | 'table_name' => 'civicrm_relationship_type', |
304 | 'entity' => 'RelationshipType', | |
305 | 'bao' => 'CRM_Contact_BAO_RelationshipType', | |
e501603b TO |
306 | ) , |
307 | ); | |
346aaaba | 308 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 309 | } |
346aaaba | 310 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
311 | } |
312 | /** | |
bd8e0b14 | 313 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
314 | * |
315 | * @return array | |
bd8e0b14 | 316 | * Array(string $name => string $uniqueName). |
e501603b TO |
317 | */ |
318 | static function &fieldKeys() { | |
bd8e0b14 TO |
319 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
320 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 321 | } |
bd8e0b14 | 322 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
323 | } |
324 | /** | |
325 | * Returns the names of this table | |
326 | * | |
327 | * @return string | |
328 | */ | |
329 | static function getTableName() { | |
330 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); | |
331 | } | |
332 | /** | |
333 | * Returns if this table needs to be logged | |
334 | * | |
335 | * @return boolean | |
336 | */ | |
337 | function getLog() { | |
338 | return self::$_log; | |
339 | } | |
340 | /** | |
341 | * Returns the list of fields that can be imported | |
342 | * | |
343 | * @param bool $prefix | |
344 | * | |
345 | * @return array | |
346 | */ | |
347 | static function &import($prefix = false) { | |
60808919 TO |
348 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'relationship_type', $prefix, array()); |
349 | return $r; | |
e501603b TO |
350 | } |
351 | /** | |
352 | * Returns the list of fields that can be exported | |
353 | * | |
354 | * @param bool $prefix | |
355 | * | |
356 | * @return array | |
357 | */ | |
358 | static function &export($prefix = false) { | |
60808919 TO |
359 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'relationship_type', $prefix, array()); |
360 | return $r; | |
e501603b TO |
361 | } |
362 | } |