5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Contact/RelationshipType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:8fb00d8376af049ce62bc57ca01bc1bf)
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 static $_tableName = 'civicrm_relationship_type';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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' => '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' => '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' => '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',
167 'name' => 'name_b_a',
168 'type' => CRM_Utils_Type
::T_STRING
,
169 'title' => ts('Relationship Type Name B to A'),
170 'description' => 'Optional name for relationship of contact_b to contact_a.',
172 'size' => CRM_Utils_Type
::BIG
,
173 'table_name' => 'civicrm_relationship_type',
174 'entity' => 'RelationshipType',
175 'bao' => 'CRM_Contact_BAO_RelationshipType',
179 'name' => 'label_b_a',
180 'type' => CRM_Utils_Type
::T_STRING
,
181 'title' => ts('Relationship Type Label B to A'),
182 'description' => 'Optional label for relationship of contact_b to contact_a.',
184 'size' => CRM_Utils_Type
::BIG
,
185 'table_name' => 'civicrm_relationship_type',
186 'entity' => 'RelationshipType',
187 'bao' => 'CRM_Contact_BAO_RelationshipType',
191 'name' => 'description',
192 'type' => CRM_Utils_Type
::T_STRING
,
193 'title' => ts('Relationship Description'),
194 'description' => 'Optional verbose description of the relationship type.',
196 'size' => CRM_Utils_Type
::HUGE
,
197 'table_name' => 'civicrm_relationship_type',
198 'entity' => 'RelationshipType',
199 'bao' => 'CRM_Contact_BAO_RelationshipType',
202 'contact_type_a' => [
203 'name' => 'contact_type_a',
204 'type' => CRM_Utils_Type
::T_STRING
,
205 'title' => ts('Contact Type for Contact A'),
206 'description' => 'If defined, contact_a in a relationship of this type must be a specific contact_type.',
208 'size' => CRM_Utils_Type
::TWELVE
,
209 'table_name' => 'civicrm_relationship_type',
210 'entity' => 'RelationshipType',
211 'bao' => 'CRM_Contact_BAO_RelationshipType',
216 'pseudoconstant' => [
217 'table' => 'civicrm_contact_type',
218 'keyColumn' => 'name',
219 'labelColumn' => 'label',
220 'condition' => 'parent_id IS NULL',
223 'contact_type_b' => [
224 'name' => 'contact_type_b',
225 'type' => CRM_Utils_Type
::T_STRING
,
226 'title' => ts('Contact Type for Contact B'),
227 'description' => 'If defined, contact_b in a relationship of this type must be a specific contact_type.',
229 'size' => CRM_Utils_Type
::TWELVE
,
230 'table_name' => 'civicrm_relationship_type',
231 'entity' => 'RelationshipType',
232 'bao' => 'CRM_Contact_BAO_RelationshipType',
237 'pseudoconstant' => [
238 'table' => 'civicrm_contact_type',
239 'keyColumn' => 'name',
240 'labelColumn' => 'label',
241 'condition' => 'parent_id IS NULL',
244 'contact_sub_type_a' => [
245 'name' => 'contact_sub_type_a',
246 'type' => CRM_Utils_Type
::T_STRING
,
247 'title' => ts('Contact Subtype A'),
248 'description' => 'If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.
251 'size' => CRM_Utils_Type
::BIG
,
252 'table_name' => 'civicrm_relationship_type',
253 'entity' => 'RelationshipType',
254 'bao' => 'CRM_Contact_BAO_RelationshipType',
259 'pseudoconstant' => [
260 'table' => 'civicrm_contact_type',
261 'keyColumn' => 'name',
262 'labelColumn' => 'label',
263 'condition' => 'parent_id IS NOT NULL',
266 'contact_sub_type_b' => [
267 'name' => 'contact_sub_type_b',
268 'type' => CRM_Utils_Type
::T_STRING
,
269 'title' => ts('Contact Subtype B'),
270 'description' => 'If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.
273 'size' => CRM_Utils_Type
::BIG
,
274 'table_name' => 'civicrm_relationship_type',
275 'entity' => 'RelationshipType',
276 'bao' => 'CRM_Contact_BAO_RelationshipType',
281 'pseudoconstant' => [
282 'table' => 'civicrm_contact_type',
283 'keyColumn' => 'name',
284 'labelColumn' => 'label',
285 'condition' => 'parent_id IS NOT NULL',
289 'name' => 'is_reserved',
290 'type' => CRM_Utils_Type
::T_BOOLEAN
,
291 'title' => ts('Relationship Type is Reserved'),
292 'description' => 'Is this relationship type a predefined system type (can not be changed or de-activated)?',
293 'table_name' => 'civicrm_relationship_type',
294 'entity' => 'RelationshipType',
295 'bao' => 'CRM_Contact_BAO_RelationshipType',
299 'name' => 'is_active',
300 'type' => CRM_Utils_Type
::T_BOOLEAN
,
301 'title' => ts('Relationship Type is Active'),
302 'description' => 'Is this relationship type currently active (i.e. can be used when creating or editing relationships)?
305 'table_name' => 'civicrm_relationship_type',
306 'entity' => 'RelationshipType',
307 'bao' => 'CRM_Contact_BAO_RelationshipType',
311 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
313 return Civi
::$statics[__CLASS__
]['fields'];
317 * Return a mapping from field-name to the corresponding key (as used in fields()).
320 * Array(string $name => string $uniqueName).
322 public static function &fieldKeys() {
323 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
324 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
326 return Civi
::$statics[__CLASS__
]['fieldKeys'];
330 * Returns the names of this table
334 public static function getTableName() {
335 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
339 * Returns if this table needs to be logged
343 public function getLog() {
348 * Returns the list of fields that can be imported
350 * @param bool $prefix
354 public static function &import($prefix = FALSE) {
355 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'relationship_type', $prefix, []);
360 * Returns the list of fields that can be exported
362 * @param bool $prefix
366 public static function &export($prefix = FALSE) {
367 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'relationship_type', $prefix, []);
372 * Returns the list of indices
374 * @param bool $localize
378 public static function indices($localize = TRUE) {
381 'name' => 'UI_name_a_b',
385 'localizable' => FALSE,
387 'sig' => 'civicrm_relationship_type::1::name_a_b',
390 'name' => 'UI_name_b_a',
394 'localizable' => FALSE,
396 'sig' => 'civicrm_relationship_type::1::name_b_a',
399 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;