5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contact/RelationshipType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:205fa87e1f397fbf810ffbbd74c1853a)
13 * Database access object for the RelationshipType entity.
15 class CRM_Contact_DAO_RelationshipType
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_relationship_type';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
39 * name for relationship of contact_a to contact_b.
46 * label for relationship of contact_a to contact_b.
53 * Optional name for relationship of contact_b to contact_a.
60 * Optional label for relationship of contact_b to contact_a.
67 * Optional verbose description of the relationship type.
74 * If defined, contact_a in a relationship of this type must be a specific contact_type.
78 public $contact_type_a;
81 * If defined, contact_b in a relationship of this type must be a specific contact_type.
85 public $contact_type_b;
88 * If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.
92 public $contact_sub_type_a;
95 * If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.
99 public $contact_sub_type_b;
102 * Is this relationship type a predefined system type (can not be changed or de-activated)?
109 * Is this relationship type currently active (i.e. can be used when creating or editing relationships)?
118 public function __construct() {
119 $this->__table
= 'civicrm_relationship_type';
120 parent
::__construct();
124 * Returns localized title of this entity.
126 public static function getEntityTitle() {
127 return ts('Relationship Types');
131 * Returns all the column names of this table
135 public static function &fields() {
136 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
137 Civi
::$statics[__CLASS__
]['fields'] = [
140 'type' => CRM_Utils_Type
::T_INT
,
141 'title' => ts('Relationship Type ID'),
142 'description' => ts('Primary key'),
144 'where' => 'civicrm_relationship_type.id',
145 'table_name' => 'civicrm_relationship_type',
146 'entity' => 'RelationshipType',
147 'bao' => 'CRM_Contact_BAO_RelationshipType',
152 'name' => 'name_a_b',
153 'type' => CRM_Utils_Type
::T_STRING
,
154 'title' => ts('Relationship Type Name A to B'),
155 'description' => ts('name for relationship of contact_a to contact_b.'),
157 'size' => CRM_Utils_Type
::BIG
,
158 'where' => 'civicrm_relationship_type.name_a_b',
159 'table_name' => 'civicrm_relationship_type',
160 'entity' => 'RelationshipType',
161 'bao' => 'CRM_Contact_BAO_RelationshipType',
166 'name' => 'label_a_b',
167 'type' => CRM_Utils_Type
::T_STRING
,
168 'title' => ts('Relationship Type Label A to B'),
169 'description' => ts('label for relationship of contact_a to contact_b.'),
171 'size' => CRM_Utils_Type
::BIG
,
172 'where' => 'civicrm_relationship_type.label_a_b',
173 'table_name' => 'civicrm_relationship_type',
174 'entity' => 'RelationshipType',
175 'bao' => 'CRM_Contact_BAO_RelationshipType',
183 'name' => 'name_b_a',
184 'type' => CRM_Utils_Type
::T_STRING
,
185 'title' => ts('Relationship Type Name B to A'),
186 'description' => ts('Optional name for relationship of contact_b to contact_a.'),
188 'size' => CRM_Utils_Type
::BIG
,
189 'where' => 'civicrm_relationship_type.name_b_a',
190 'table_name' => 'civicrm_relationship_type',
191 'entity' => 'RelationshipType',
192 'bao' => 'CRM_Contact_BAO_RelationshipType',
197 'name' => 'label_b_a',
198 'type' => CRM_Utils_Type
::T_STRING
,
199 'title' => ts('Relationship Type Label B to A'),
200 'description' => ts('Optional label for relationship of contact_b to contact_a.'),
202 'size' => CRM_Utils_Type
::BIG
,
203 'where' => 'civicrm_relationship_type.label_b_a',
204 'table_name' => 'civicrm_relationship_type',
205 'entity' => 'RelationshipType',
206 'bao' => 'CRM_Contact_BAO_RelationshipType',
214 'name' => 'description',
215 'type' => CRM_Utils_Type
::T_STRING
,
216 'title' => ts('Relationship Description'),
217 'description' => ts('Optional verbose description of the relationship type.'),
219 'size' => CRM_Utils_Type
::HUGE
,
220 'where' => 'civicrm_relationship_type.description',
221 'table_name' => 'civicrm_relationship_type',
222 'entity' => 'RelationshipType',
223 'bao' => 'CRM_Contact_BAO_RelationshipType',
230 'contact_type_a' => [
231 'name' => 'contact_type_a',
232 'type' => CRM_Utils_Type
::T_STRING
,
233 'title' => ts('Contact Type for Contact A'),
234 'description' => ts('If defined, contact_a in a relationship of this type must be a specific contact_type.'),
236 'size' => CRM_Utils_Type
::TWELVE
,
237 'where' => 'civicrm_relationship_type.contact_type_a',
238 'table_name' => 'civicrm_relationship_type',
239 'entity' => 'RelationshipType',
240 'bao' => 'CRM_Contact_BAO_RelationshipType',
245 'pseudoconstant' => [
246 'table' => 'civicrm_contact_type',
247 'keyColumn' => 'name',
248 'labelColumn' => 'label',
249 'condition' => 'parent_id IS NULL',
253 'contact_type_b' => [
254 'name' => 'contact_type_b',
255 'type' => CRM_Utils_Type
::T_STRING
,
256 'title' => ts('Contact Type for Contact B'),
257 'description' => ts('If defined, contact_b in a relationship of this type must be a specific contact_type.'),
259 'size' => CRM_Utils_Type
::TWELVE
,
260 'where' => 'civicrm_relationship_type.contact_type_b',
261 'table_name' => 'civicrm_relationship_type',
262 'entity' => 'RelationshipType',
263 'bao' => 'CRM_Contact_BAO_RelationshipType',
268 'pseudoconstant' => [
269 'table' => 'civicrm_contact_type',
270 'keyColumn' => 'name',
271 'labelColumn' => 'label',
272 'condition' => 'parent_id IS NULL',
276 'contact_sub_type_a' => [
277 'name' => 'contact_sub_type_a',
278 'type' => CRM_Utils_Type
::T_STRING
,
279 'title' => ts('Contact Subtype A'),
280 'description' => ts('If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.'),
282 'size' => CRM_Utils_Type
::BIG
,
283 'where' => 'civicrm_relationship_type.contact_sub_type_a',
284 'table_name' => 'civicrm_relationship_type',
285 'entity' => 'RelationshipType',
286 'bao' => 'CRM_Contact_BAO_RelationshipType',
291 'pseudoconstant' => [
292 'table' => 'civicrm_contact_type',
293 'keyColumn' => 'name',
294 'labelColumn' => 'label',
295 'condition' => 'parent_id IS NOT NULL',
299 'contact_sub_type_b' => [
300 'name' => 'contact_sub_type_b',
301 'type' => CRM_Utils_Type
::T_STRING
,
302 'title' => ts('Contact Subtype B'),
303 'description' => ts('If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.'),
305 'size' => CRM_Utils_Type
::BIG
,
306 'where' => 'civicrm_relationship_type.contact_sub_type_b',
307 'table_name' => 'civicrm_relationship_type',
308 'entity' => 'RelationshipType',
309 'bao' => 'CRM_Contact_BAO_RelationshipType',
314 'pseudoconstant' => [
315 'table' => 'civicrm_contact_type',
316 'keyColumn' => 'name',
317 'labelColumn' => 'label',
318 'condition' => 'parent_id IS NOT NULL',
323 'name' => 'is_reserved',
324 'type' => CRM_Utils_Type
::T_BOOLEAN
,
325 'title' => ts('Relationship Type is Reserved'),
326 'description' => ts('Is this relationship type a predefined system type (can not be changed or de-activated)?'),
327 'where' => 'civicrm_relationship_type.is_reserved',
328 'table_name' => 'civicrm_relationship_type',
329 'entity' => 'RelationshipType',
330 'bao' => 'CRM_Contact_BAO_RelationshipType',
333 'type' => 'CheckBox',
338 'name' => 'is_active',
339 'type' => CRM_Utils_Type
::T_BOOLEAN
,
340 'title' => ts('Relationship Type is Active'),
341 'description' => ts('Is this relationship type currently active (i.e. can be used when creating or editing relationships)?'),
342 'where' => 'civicrm_relationship_type.is_active',
344 'table_name' => 'civicrm_relationship_type',
345 'entity' => 'RelationshipType',
346 'bao' => 'CRM_Contact_BAO_RelationshipType',
349 'type' => 'CheckBox',
354 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
356 return Civi
::$statics[__CLASS__
]['fields'];
360 * Return a mapping from field-name to the corresponding key (as used in fields()).
363 * Array(string $name => string $uniqueName).
365 public static function &fieldKeys() {
366 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
367 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
369 return Civi
::$statics[__CLASS__
]['fieldKeys'];
373 * Returns the names of this table
377 public static function getTableName() {
378 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
382 * Returns if this table needs to be logged
386 public function getLog() {
391 * Returns the list of fields that can be imported
393 * @param bool $prefix
397 public static function &import($prefix = FALSE) {
398 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'relationship_type', $prefix, []);
403 * Returns the list of fields that can be exported
405 * @param bool $prefix
409 public static function &export($prefix = FALSE) {
410 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'relationship_type', $prefix, []);
415 * Returns the list of indices
417 * @param bool $localize
421 public static function indices($localize = TRUE) {
424 'name' => 'UI_name_a_b',
428 'localizable' => FALSE,
430 'sig' => 'civicrm_relationship_type::1::name_a_b',
433 'name' => 'UI_name_b_a',
437 'localizable' => FALSE,
439 'sig' => 'civicrm_relationship_type::1::name_b_a',
442 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;