5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Contact/RelationshipType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:78a8cea89e73b1a409f7908ad08cf99e)
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 all the column names of this table
128 public static function &fields() {
129 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
130 Civi
::$statics[__CLASS__
]['fields'] = [
133 'type' => CRM_Utils_Type
::T_INT
,
134 'title' => ts('Relationship Type ID'),
135 'description' => ts('Primary key'),
137 'where' => 'civicrm_relationship_type.id',
138 'table_name' => 'civicrm_relationship_type',
139 'entity' => 'RelationshipType',
140 'bao' => 'CRM_Contact_BAO_RelationshipType',
144 'name' => 'name_a_b',
145 'type' => CRM_Utils_Type
::T_STRING
,
146 'title' => ts('Relationship Type Name A to B'),
147 'description' => ts('name for relationship of contact_a to contact_b.'),
149 'size' => CRM_Utils_Type
::BIG
,
150 'where' => 'civicrm_relationship_type.name_a_b',
151 'table_name' => 'civicrm_relationship_type',
152 'entity' => 'RelationshipType',
153 'bao' => 'CRM_Contact_BAO_RelationshipType',
157 'name' => 'label_a_b',
158 'type' => CRM_Utils_Type
::T_STRING
,
159 'title' => ts('Relationship Type Label A to B'),
160 'description' => ts('label for relationship of contact_a to contact_b.'),
162 'size' => CRM_Utils_Type
::BIG
,
163 'where' => 'civicrm_relationship_type.label_a_b',
164 'table_name' => 'civicrm_relationship_type',
165 'entity' => 'RelationshipType',
166 'bao' => 'CRM_Contact_BAO_RelationshipType',
173 'name' => 'name_b_a',
174 'type' => CRM_Utils_Type
::T_STRING
,
175 'title' => ts('Relationship Type Name B to A'),
176 'description' => ts('Optional name for relationship of contact_b to contact_a.'),
178 'size' => CRM_Utils_Type
::BIG
,
179 'where' => 'civicrm_relationship_type.name_b_a',
180 'table_name' => 'civicrm_relationship_type',
181 'entity' => 'RelationshipType',
182 'bao' => 'CRM_Contact_BAO_RelationshipType',
186 'name' => 'label_b_a',
187 'type' => CRM_Utils_Type
::T_STRING
,
188 'title' => ts('Relationship Type Label B to A'),
189 'description' => ts('Optional label for relationship of contact_b to contact_a.'),
191 'size' => CRM_Utils_Type
::BIG
,
192 'where' => 'civicrm_relationship_type.label_b_a',
193 'table_name' => 'civicrm_relationship_type',
194 'entity' => 'RelationshipType',
195 'bao' => 'CRM_Contact_BAO_RelationshipType',
202 'name' => 'description',
203 'type' => CRM_Utils_Type
::T_STRING
,
204 'title' => ts('Relationship Description'),
205 'description' => ts('Optional verbose description of the relationship type.'),
207 'size' => CRM_Utils_Type
::HUGE
,
208 'where' => 'civicrm_relationship_type.description',
209 'table_name' => 'civicrm_relationship_type',
210 'entity' => 'RelationshipType',
211 'bao' => 'CRM_Contact_BAO_RelationshipType',
217 'contact_type_a' => [
218 'name' => 'contact_type_a',
219 'type' => CRM_Utils_Type
::T_STRING
,
220 'title' => ts('Contact Type for Contact A'),
221 'description' => ts('If defined, contact_a in a relationship of this type must be a specific contact_type.'),
223 'size' => CRM_Utils_Type
::TWELVE
,
224 'where' => 'civicrm_relationship_type.contact_type_a',
225 'table_name' => 'civicrm_relationship_type',
226 'entity' => 'RelationshipType',
227 'bao' => 'CRM_Contact_BAO_RelationshipType',
232 'pseudoconstant' => [
233 'table' => 'civicrm_contact_type',
234 'keyColumn' => 'name',
235 'labelColumn' => 'label',
236 'condition' => 'parent_id IS NULL',
239 'contact_type_b' => [
240 'name' => 'contact_type_b',
241 'type' => CRM_Utils_Type
::T_STRING
,
242 'title' => ts('Contact Type for Contact B'),
243 'description' => ts('If defined, contact_b in a relationship of this type must be a specific contact_type.'),
245 'size' => CRM_Utils_Type
::TWELVE
,
246 'where' => 'civicrm_relationship_type.contact_type_b',
247 'table_name' => 'civicrm_relationship_type',
248 'entity' => 'RelationshipType',
249 'bao' => 'CRM_Contact_BAO_RelationshipType',
254 'pseudoconstant' => [
255 'table' => 'civicrm_contact_type',
256 'keyColumn' => 'name',
257 'labelColumn' => 'label',
258 'condition' => 'parent_id IS NULL',
261 'contact_sub_type_a' => [
262 'name' => 'contact_sub_type_a',
263 'type' => CRM_Utils_Type
::T_STRING
,
264 'title' => ts('Contact Subtype A'),
265 'description' => ts('If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.'),
267 'size' => CRM_Utils_Type
::BIG
,
268 'where' => 'civicrm_relationship_type.contact_sub_type_a',
269 'table_name' => 'civicrm_relationship_type',
270 'entity' => 'RelationshipType',
271 'bao' => 'CRM_Contact_BAO_RelationshipType',
276 'pseudoconstant' => [
277 'table' => 'civicrm_contact_type',
278 'keyColumn' => 'name',
279 'labelColumn' => 'label',
280 'condition' => 'parent_id IS NOT NULL',
283 'contact_sub_type_b' => [
284 'name' => 'contact_sub_type_b',
285 'type' => CRM_Utils_Type
::T_STRING
,
286 'title' => ts('Contact Subtype B'),
287 'description' => ts('If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.'),
289 'size' => CRM_Utils_Type
::BIG
,
290 'where' => 'civicrm_relationship_type.contact_sub_type_b',
291 'table_name' => 'civicrm_relationship_type',
292 'entity' => 'RelationshipType',
293 'bao' => 'CRM_Contact_BAO_RelationshipType',
298 'pseudoconstant' => [
299 'table' => 'civicrm_contact_type',
300 'keyColumn' => 'name',
301 'labelColumn' => 'label',
302 'condition' => 'parent_id IS NOT NULL',
306 'name' => 'is_reserved',
307 'type' => CRM_Utils_Type
::T_BOOLEAN
,
308 'title' => ts('Relationship Type is Reserved'),
309 'description' => ts('Is this relationship type a predefined system type (can not be changed or de-activated)?'),
310 'where' => 'civicrm_relationship_type.is_reserved',
311 'table_name' => 'civicrm_relationship_type',
312 'entity' => 'RelationshipType',
313 'bao' => 'CRM_Contact_BAO_RelationshipType',
316 'type' => 'CheckBox',
320 'name' => 'is_active',
321 'type' => CRM_Utils_Type
::T_BOOLEAN
,
322 'title' => ts('Relationship Type is Active'),
323 'description' => ts('Is this relationship type currently active (i.e. can be used when creating or editing relationships)?'),
324 'where' => 'civicrm_relationship_type.is_active',
326 'table_name' => 'civicrm_relationship_type',
327 'entity' => 'RelationshipType',
328 'bao' => 'CRM_Contact_BAO_RelationshipType',
331 'type' => 'CheckBox',
335 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
337 return Civi
::$statics[__CLASS__
]['fields'];
341 * Return a mapping from field-name to the corresponding key (as used in fields()).
344 * Array(string $name => string $uniqueName).
346 public static function &fieldKeys() {
347 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
348 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
350 return Civi
::$statics[__CLASS__
]['fieldKeys'];
354 * Returns the names of this table
358 public static function getTableName() {
359 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
363 * Returns if this table needs to be logged
367 public function getLog() {
372 * Returns the list of fields that can be imported
374 * @param bool $prefix
378 public static function &import($prefix = FALSE) {
379 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'relationship_type', $prefix, []);
384 * Returns the list of fields that can be exported
386 * @param bool $prefix
390 public static function &export($prefix = FALSE) {
391 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'relationship_type', $prefix, []);
396 * Returns the list of indices
398 * @param bool $localize
402 public static function indices($localize = TRUE) {
405 'name' => 'UI_name_a_b',
409 'localizable' => FALSE,
411 'sig' => 'civicrm_relationship_type::1::name_a_b',
414 'name' => 'UI_name_b_a',
418 'localizable' => FALSE,
420 'sig' => 'civicrm_relationship_type::1::name_b_a',
423 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;