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