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:9fa07d6d85caa27a637694324ea5b740)
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 'table_name' => 'civicrm_relationship_type',
138 'entity' => 'RelationshipType',
139 'bao' => 'CRM_Contact_BAO_RelationshipType',
143 'name' => 'name_a_b',
144 'type' => CRM_Utils_Type
::T_STRING
,
145 'title' => ts('Relationship Type Name A to B'),
146 'description' => ts('name for relationship of contact_a to contact_b.'),
148 'size' => CRM_Utils_Type
::BIG
,
149 'table_name' => 'civicrm_relationship_type',
150 'entity' => 'RelationshipType',
151 'bao' => 'CRM_Contact_BAO_RelationshipType',
155 'name' => 'label_a_b',
156 'type' => CRM_Utils_Type
::T_STRING
,
157 'title' => ts('Relationship Type Label A to B'),
158 'description' => ts('label for relationship of contact_a to contact_b.'),
160 'size' => CRM_Utils_Type
::BIG
,
161 'table_name' => 'civicrm_relationship_type',
162 'entity' => 'RelationshipType',
163 'bao' => 'CRM_Contact_BAO_RelationshipType',
170 'name' => 'name_b_a',
171 'type' => CRM_Utils_Type
::T_STRING
,
172 'title' => ts('Relationship Type Name B to A'),
173 'description' => ts('Optional name for relationship of contact_b to contact_a.'),
175 'size' => CRM_Utils_Type
::BIG
,
176 'table_name' => 'civicrm_relationship_type',
177 'entity' => 'RelationshipType',
178 'bao' => 'CRM_Contact_BAO_RelationshipType',
182 'name' => 'label_b_a',
183 'type' => CRM_Utils_Type
::T_STRING
,
184 'title' => ts('Relationship Type Label B to A'),
185 'description' => ts('Optional label for relationship of contact_b to contact_a.'),
187 'size' => CRM_Utils_Type
::BIG
,
188 'table_name' => 'civicrm_relationship_type',
189 'entity' => 'RelationshipType',
190 'bao' => 'CRM_Contact_BAO_RelationshipType',
197 'name' => 'description',
198 'type' => CRM_Utils_Type
::T_STRING
,
199 'title' => ts('Relationship Description'),
200 'description' => ts('Optional verbose description of the relationship type.'),
202 'size' => CRM_Utils_Type
::HUGE
,
203 'table_name' => 'civicrm_relationship_type',
204 'entity' => 'RelationshipType',
205 'bao' => 'CRM_Contact_BAO_RelationshipType',
211 'contact_type_a' => [
212 'name' => 'contact_type_a',
213 'type' => CRM_Utils_Type
::T_STRING
,
214 'title' => ts('Contact Type for Contact A'),
215 'description' => ts('If defined, contact_a in a relationship of this type must be a specific contact_type.'),
217 'size' => CRM_Utils_Type
::TWELVE
,
218 'table_name' => 'civicrm_relationship_type',
219 'entity' => 'RelationshipType',
220 'bao' => 'CRM_Contact_BAO_RelationshipType',
225 'pseudoconstant' => [
226 'table' => 'civicrm_contact_type',
227 'keyColumn' => 'name',
228 'labelColumn' => 'label',
229 'condition' => 'parent_id IS NULL',
232 'contact_type_b' => [
233 'name' => 'contact_type_b',
234 'type' => CRM_Utils_Type
::T_STRING
,
235 'title' => ts('Contact Type for Contact B'),
236 'description' => ts('If defined, contact_b in a relationship of this type must be a specific contact_type.'),
238 'size' => CRM_Utils_Type
::TWELVE
,
239 'table_name' => 'civicrm_relationship_type',
240 'entity' => 'RelationshipType',
241 'bao' => 'CRM_Contact_BAO_RelationshipType',
246 'pseudoconstant' => [
247 'table' => 'civicrm_contact_type',
248 'keyColumn' => 'name',
249 'labelColumn' => 'label',
250 'condition' => 'parent_id IS NULL',
253 'contact_sub_type_a' => [
254 'name' => 'contact_sub_type_a',
255 'type' => CRM_Utils_Type
::T_STRING
,
256 'title' => ts('Contact Subtype A'),
257 'description' => ts('If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.
260 'size' => CRM_Utils_Type
::BIG
,
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 NOT NULL',
275 'contact_sub_type_b' => [
276 'name' => 'contact_sub_type_b',
277 'type' => CRM_Utils_Type
::T_STRING
,
278 'title' => ts('Contact Subtype B'),
279 'description' => ts('If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.
282 'size' => CRM_Utils_Type
::BIG
,
283 'table_name' => 'civicrm_relationship_type',
284 'entity' => 'RelationshipType',
285 'bao' => 'CRM_Contact_BAO_RelationshipType',
290 'pseudoconstant' => [
291 'table' => 'civicrm_contact_type',
292 'keyColumn' => 'name',
293 'labelColumn' => 'label',
294 'condition' => 'parent_id IS NOT NULL',
298 'name' => 'is_reserved',
299 'type' => CRM_Utils_Type
::T_BOOLEAN
,
300 'title' => ts('Relationship Type is Reserved'),
301 'description' => ts('Is this relationship type a predefined system type (can not be changed or de-activated)?'),
302 'table_name' => 'civicrm_relationship_type',
303 'entity' => 'RelationshipType',
304 'bao' => 'CRM_Contact_BAO_RelationshipType',
307 'type' => 'CheckBox',
311 'name' => 'is_active',
312 'type' => CRM_Utils_Type
::T_BOOLEAN
,
313 'title' => ts('Relationship Type is Active'),
314 'description' => ts('Is this relationship type currently active (i.e. can be used when creating or editing relationships)?
317 'table_name' => 'civicrm_relationship_type',
318 'entity' => 'RelationshipType',
319 'bao' => 'CRM_Contact_BAO_RelationshipType',
322 'type' => 'CheckBox',
326 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
328 return Civi
::$statics[__CLASS__
]['fields'];
332 * Return a mapping from field-name to the corresponding key (as used in fields()).
335 * Array(string $name => string $uniqueName).
337 public static function &fieldKeys() {
338 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
339 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
341 return Civi
::$statics[__CLASS__
]['fieldKeys'];
345 * Returns the names of this table
349 public static function getTableName() {
350 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
354 * Returns if this table needs to be logged
358 public function getLog() {
363 * Returns the list of fields that can be imported
365 * @param bool $prefix
369 public static function &import($prefix = FALSE) {
370 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'relationship_type', $prefix, []);
375 * Returns the list of fields that can be exported
377 * @param bool $prefix
381 public static function &export($prefix = FALSE) {
382 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'relationship_type', $prefix, []);
387 * Returns the list of indices
389 * @param bool $localize
393 public static function indices($localize = TRUE) {
396 'name' => 'UI_name_a_b',
400 'localizable' => FALSE,
402 'sig' => 'civicrm_relationship_type::1::name_a_b',
405 'name' => 'UI_name_b_a',
409 'localizable' => FALSE,
411 'sig' => 'civicrm_relationship_type::1::name_b_a',
414 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;