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:81dab8a4d80601fe4afa3dc1556cc804)
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',
151 'name' => 'name_a_b',
152 'type' => CRM_Utils_Type
::T_STRING
,
153 'title' => ts('Relationship Type Name A to B'),
154 'description' => ts('name for relationship of contact_a to contact_b.'),
156 'size' => CRM_Utils_Type
::BIG
,
157 'where' => 'civicrm_relationship_type.name_a_b',
158 'table_name' => 'civicrm_relationship_type',
159 'entity' => 'RelationshipType',
160 'bao' => 'CRM_Contact_BAO_RelationshipType',
164 'name' => 'label_a_b',
165 'type' => CRM_Utils_Type
::T_STRING
,
166 'title' => ts('Relationship Type Label A to B'),
167 'description' => ts('label for relationship of contact_a to contact_b.'),
169 'size' => CRM_Utils_Type
::BIG
,
170 'where' => 'civicrm_relationship_type.label_a_b',
171 'table_name' => 'civicrm_relationship_type',
172 'entity' => 'RelationshipType',
173 'bao' => 'CRM_Contact_BAO_RelationshipType',
180 'name' => 'name_b_a',
181 'type' => CRM_Utils_Type
::T_STRING
,
182 'title' => ts('Relationship Type Name B to A'),
183 'description' => ts('Optional name for relationship of contact_b to contact_a.'),
185 'size' => CRM_Utils_Type
::BIG
,
186 'where' => 'civicrm_relationship_type.name_b_a',
187 'table_name' => 'civicrm_relationship_type',
188 'entity' => 'RelationshipType',
189 'bao' => 'CRM_Contact_BAO_RelationshipType',
193 'name' => 'label_b_a',
194 'type' => CRM_Utils_Type
::T_STRING
,
195 'title' => ts('Relationship Type Label B to A'),
196 'description' => ts('Optional label for relationship of contact_b to contact_a.'),
198 'size' => CRM_Utils_Type
::BIG
,
199 'where' => 'civicrm_relationship_type.label_b_a',
200 'table_name' => 'civicrm_relationship_type',
201 'entity' => 'RelationshipType',
202 'bao' => 'CRM_Contact_BAO_RelationshipType',
209 'name' => 'description',
210 'type' => CRM_Utils_Type
::T_STRING
,
211 'title' => ts('Relationship Description'),
212 'description' => ts('Optional verbose description of the relationship type.'),
214 'size' => CRM_Utils_Type
::HUGE
,
215 'where' => 'civicrm_relationship_type.description',
216 'table_name' => 'civicrm_relationship_type',
217 'entity' => 'RelationshipType',
218 'bao' => 'CRM_Contact_BAO_RelationshipType',
224 'contact_type_a' => [
225 'name' => 'contact_type_a',
226 'type' => CRM_Utils_Type
::T_STRING
,
227 'title' => ts('Contact Type for Contact A'),
228 'description' => ts('If defined, contact_a in a relationship of this type must be a specific contact_type.'),
230 'size' => CRM_Utils_Type
::TWELVE
,
231 'where' => 'civicrm_relationship_type.contact_type_a',
232 'table_name' => 'civicrm_relationship_type',
233 'entity' => 'RelationshipType',
234 'bao' => 'CRM_Contact_BAO_RelationshipType',
239 'pseudoconstant' => [
240 'table' => 'civicrm_contact_type',
241 'keyColumn' => 'name',
242 'labelColumn' => 'label',
243 'condition' => 'parent_id IS NULL',
246 'contact_type_b' => [
247 'name' => 'contact_type_b',
248 'type' => CRM_Utils_Type
::T_STRING
,
249 'title' => ts('Contact Type for Contact B'),
250 'description' => ts('If defined, contact_b in a relationship of this type must be a specific contact_type.'),
252 'size' => CRM_Utils_Type
::TWELVE
,
253 'where' => 'civicrm_relationship_type.contact_type_b',
254 'table_name' => 'civicrm_relationship_type',
255 'entity' => 'RelationshipType',
256 'bao' => 'CRM_Contact_BAO_RelationshipType',
261 'pseudoconstant' => [
262 'table' => 'civicrm_contact_type',
263 'keyColumn' => 'name',
264 'labelColumn' => 'label',
265 'condition' => 'parent_id IS NULL',
268 'contact_sub_type_a' => [
269 'name' => 'contact_sub_type_a',
270 'type' => CRM_Utils_Type
::T_STRING
,
271 'title' => ts('Contact Subtype A'),
272 'description' => ts('If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.'),
274 'size' => CRM_Utils_Type
::BIG
,
275 'where' => 'civicrm_relationship_type.contact_sub_type_a',
276 'table_name' => 'civicrm_relationship_type',
277 'entity' => 'RelationshipType',
278 'bao' => 'CRM_Contact_BAO_RelationshipType',
283 'pseudoconstant' => [
284 'table' => 'civicrm_contact_type',
285 'keyColumn' => 'name',
286 'labelColumn' => 'label',
287 'condition' => 'parent_id IS NOT NULL',
290 'contact_sub_type_b' => [
291 'name' => 'contact_sub_type_b',
292 'type' => CRM_Utils_Type
::T_STRING
,
293 'title' => ts('Contact Subtype B'),
294 'description' => ts('If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.'),
296 'size' => CRM_Utils_Type
::BIG
,
297 'where' => 'civicrm_relationship_type.contact_sub_type_b',
298 'table_name' => 'civicrm_relationship_type',
299 'entity' => 'RelationshipType',
300 'bao' => 'CRM_Contact_BAO_RelationshipType',
305 'pseudoconstant' => [
306 'table' => 'civicrm_contact_type',
307 'keyColumn' => 'name',
308 'labelColumn' => 'label',
309 'condition' => 'parent_id IS NOT NULL',
313 'name' => 'is_reserved',
314 'type' => CRM_Utils_Type
::T_BOOLEAN
,
315 'title' => ts('Relationship Type is Reserved'),
316 'description' => ts('Is this relationship type a predefined system type (can not be changed or de-activated)?'),
317 'where' => 'civicrm_relationship_type.is_reserved',
318 'table_name' => 'civicrm_relationship_type',
319 'entity' => 'RelationshipType',
320 'bao' => 'CRM_Contact_BAO_RelationshipType',
323 'type' => 'CheckBox',
327 'name' => 'is_active',
328 'type' => CRM_Utils_Type
::T_BOOLEAN
,
329 'title' => ts('Relationship Type is Active'),
330 'description' => ts('Is this relationship type currently active (i.e. can be used when creating or editing relationships)?'),
331 'where' => 'civicrm_relationship_type.is_active',
333 'table_name' => 'civicrm_relationship_type',
334 'entity' => 'RelationshipType',
335 'bao' => 'CRM_Contact_BAO_RelationshipType',
338 'type' => 'CheckBox',
342 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
344 return Civi
::$statics[__CLASS__
]['fields'];
348 * Return a mapping from field-name to the corresponding key (as used in fields()).
351 * Array(string $name => string $uniqueName).
353 public static function &fieldKeys() {
354 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
355 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
357 return Civi
::$statics[__CLASS__
]['fieldKeys'];
361 * Returns the names of this table
365 public static function getTableName() {
366 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
370 * Returns if this table needs to be logged
374 public function getLog() {
379 * Returns the list of fields that can be imported
381 * @param bool $prefix
385 public static function &import($prefix = FALSE) {
386 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'relationship_type', $prefix, []);
391 * Returns the list of fields that can be exported
393 * @param bool $prefix
397 public static function &export($prefix = FALSE) {
398 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'relationship_type', $prefix, []);
403 * Returns the list of indices
405 * @param bool $localize
409 public static function indices($localize = TRUE) {
412 'name' => 'UI_name_a_b',
416 'localizable' => FALSE,
418 'sig' => 'civicrm_relationship_type::1::name_a_b',
421 'name' => 'UI_name_b_a',
425 'localizable' => FALSE,
427 'sig' => 'civicrm_relationship_type::1::name_b_a',
430 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;