5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contact/RelationshipVortex.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:01ed7a8f57a4438462decea08a76138a)
13 * Database access object for the RelationshipVortex entity.
15 class CRM_Contact_DAO_RelationshipVortex
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_relationship_vtx';
25 * Icon associated with this entity.
29 public static $_icon = 'fa-handshake-o';
32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 public static $_log = FALSE;
39 * Relationship Vortex ID
46 * id of the relationship (FK to civicrm_relationship.id)
50 public $relationship_id;
53 * id of the relationship type
57 public $relationship_type_id;
60 * The vortex record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.
67 * id of the first contact
71 public $near_contact_id;
74 * name for relationship of near_contact to far_contact.
78 public $near_relation;
81 * id of the second contact
85 public $far_contact_id;
88 * name for relationship of far_contact to near_contact.
95 * is the relationship active ?
102 * date when the relationship started
109 * date when the relationship ended
125 public function __construct() {
126 $this->__table
= 'civicrm_relationship_vtx';
127 parent
::__construct();
131 * Returns localized title of this entity.
133 public static function getEntityTitle() {
134 return ts('Relationship Vortexes');
138 * Returns foreign keys and entity references.
141 * [CRM_Core_Reference_Interface]
143 public static function getReferenceColumns() {
144 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
145 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
146 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'relationship_id', 'civicrm_relationship', 'id');
147 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'relationship_type_id', 'civicrm_relationship_type', 'id');
148 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'near_contact_id', 'civicrm_contact', 'id');
149 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'far_contact_id', 'civicrm_contact', 'id');
150 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'case_id', 'civicrm_case', 'id');
151 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
153 return Civi
::$statics[__CLASS__
]['links'];
157 * Returns all the column names of this table
161 public static function &fields() {
162 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
163 Civi
::$statics[__CLASS__
]['fields'] = [
166 'type' => CRM_Utils_Type
::T_INT
,
167 'title' => ts('Relationship Vortex ID'),
168 'description' => ts('Relationship Vortex ID'),
170 'where' => 'civicrm_relationship_vtx.id',
171 'table_name' => 'civicrm_relationship_vtx',
172 'entity' => 'RelationshipVortex',
173 'bao' => 'CRM_Contact_BAO_RelationshipVortex',
177 'relationship_id' => [
178 'name' => 'relationship_id',
179 'type' => CRM_Utils_Type
::T_INT
,
180 'title' => ts('Relationship'),
181 'description' => ts('id of the relationship (FK to civicrm_relationship.id)'),
183 'where' => 'civicrm_relationship_vtx.relationship_id',
184 'table_name' => 'civicrm_relationship_vtx',
185 'entity' => 'RelationshipVortex',
186 'bao' => 'CRM_Contact_BAO_RelationshipVortex',
188 'FKClassName' => 'CRM_Contact_DAO_Relationship',
191 'relationship_type_id' => [
192 'name' => 'relationship_type_id',
193 'type' => CRM_Utils_Type
::T_INT
,
194 'title' => ts('Relationship Type'),
195 'description' => ts('id of the relationship type'),
197 'where' => 'civicrm_relationship_vtx.relationship_type_id',
198 'table_name' => 'civicrm_relationship_vtx',
199 'entity' => 'RelationshipVortex',
200 'bao' => 'CRM_Contact_BAO_RelationshipVortex',
202 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
206 'name' => 'orientation',
207 'type' => CRM_Utils_Type
::T_STRING
,
208 'title' => ts('Orientation (a_b or b_a)'),
209 'description' => ts('The vortex record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.'),
212 'size' => CRM_Utils_Type
::FOUR
,
213 'where' => 'civicrm_relationship_vtx.orientation',
214 'table_name' => 'civicrm_relationship_vtx',
215 'entity' => 'RelationshipVortex',
216 'bao' => 'CRM_Contact_BAO_RelationshipVortex',
220 'near_contact_id' => [
221 'name' => 'near_contact_id',
222 'type' => CRM_Utils_Type
::T_INT
,
223 'title' => ts('Contact ID (Near side)'),
224 'description' => ts('id of the first contact'),
226 'where' => 'civicrm_relationship_vtx.near_contact_id',
227 'table_name' => 'civicrm_relationship_vtx',
228 'entity' => 'RelationshipVortex',
229 'bao' => 'CRM_Contact_BAO_RelationshipVortex',
231 'FKClassName' => 'CRM_Contact_DAO_Contact',
235 'name' => 'near_relation',
236 'type' => CRM_Utils_Type
::T_STRING
,
237 'title' => ts('Relationship Name (Near side)'),
238 'description' => ts('name for relationship of near_contact to far_contact.'),
240 'size' => CRM_Utils_Type
::BIG
,
241 'where' => 'civicrm_relationship_vtx.near_relation',
242 'table_name' => 'civicrm_relationship_vtx',
243 'entity' => 'RelationshipVortex',
244 'bao' => 'CRM_Contact_BAO_RelationshipVortex',
248 'far_contact_id' => [
249 'name' => 'far_contact_id',
250 'type' => CRM_Utils_Type
::T_INT
,
251 'title' => ts('Contact ID (Far side)'),
252 'description' => ts('id of the second contact'),
254 'where' => 'civicrm_relationship_vtx.far_contact_id',
255 'table_name' => 'civicrm_relationship_vtx',
256 'entity' => 'RelationshipVortex',
257 'bao' => 'CRM_Contact_BAO_RelationshipVortex',
259 'FKClassName' => 'CRM_Contact_DAO_Contact',
261 'type' => 'EntityRef',
266 'name' => 'far_relation',
267 'type' => CRM_Utils_Type
::T_STRING
,
268 'title' => ts('Relationship Name (Near side)'),
269 'description' => ts('name for relationship of far_contact to near_contact.'),
271 'size' => CRM_Utils_Type
::BIG
,
272 'where' => 'civicrm_relationship_vtx.far_relation',
273 'table_name' => 'civicrm_relationship_vtx',
274 'entity' => 'RelationshipVortex',
275 'bao' => 'CRM_Contact_BAO_RelationshipVortex',
280 'name' => 'is_active',
281 'type' => CRM_Utils_Type
::T_BOOLEAN
,
282 'title' => ts('Relationship Is Active'),
283 'description' => ts('is the relationship active ?'),
284 'where' => 'civicrm_relationship_vtx.is_active',
286 'table_name' => 'civicrm_relationship_vtx',
287 'entity' => 'RelationshipVortex',
288 'bao' => 'CRM_Contact_BAO_RelationshipVortex',
291 'type' => 'CheckBox',
295 'relationship_start_date' => [
296 'name' => 'start_date',
297 'type' => CRM_Utils_Type
::T_DATE
,
298 'title' => ts('Relationship Start Date'),
299 'description' => ts('date when the relationship started'),
300 'where' => 'civicrm_relationship_vtx.start_date',
301 'table_name' => 'civicrm_relationship_vtx',
302 'entity' => 'RelationshipVortex',
303 'bao' => 'CRM_Contact_BAO_RelationshipVortex',
306 'type' => 'Select Date',
307 'formatType' => 'activityDate',
311 'relationship_end_date' => [
312 'name' => 'end_date',
313 'type' => CRM_Utils_Type
::T_DATE
,
314 'title' => ts('Relationship End Date'),
315 'description' => ts('date when the relationship ended'),
316 'where' => 'civicrm_relationship_vtx.end_date',
317 'table_name' => 'civicrm_relationship_vtx',
318 'entity' => 'RelationshipVortex',
319 'bao' => 'CRM_Contact_BAO_RelationshipVortex',
322 'type' => 'Select Date',
323 'formatType' => 'activityDate',
329 'type' => CRM_Utils_Type
::T_INT
,
330 'title' => ts('Relationship Case'),
331 'description' => ts('FK to civicrm_case'),
332 'where' => 'civicrm_relationship_vtx.case_id',
334 'table_name' => 'civicrm_relationship_vtx',
335 'entity' => 'RelationshipVortex',
336 'bao' => 'CRM_Contact_BAO_RelationshipVortex',
338 'FKClassName' => 'CRM_Case_DAO_Case',
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 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_vtx', $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_vtx', $prefix, []);
403 * Returns the list of indices
405 * @param bool $localize
409 public static function indices($localize = TRUE) {
411 'UI_relationship' => [
412 'name' => 'UI_relationship',
414 0 => 'relationship_id',
417 'localizable' => FALSE,
419 'sig' => 'civicrm_relationship_vtx::1::relationship_id::orientation',
421 'index_nearid_nearrelation' => [
422 'name' => 'index_nearid_nearrelation',
424 0 => 'near_contact_id',
425 1 => 'near_relation',
427 'localizable' => FALSE,
428 'sig' => 'civicrm_relationship_vtx::0::near_contact_id::near_relation',
430 'index_nearid_farrelation' => [
431 'name' => 'index_nearid_farrelation',
433 0 => 'near_contact_id',
436 'localizable' => FALSE,
437 'sig' => 'civicrm_relationship_vtx::0::near_contact_id::far_relation',
439 'index_near_relation' => [
440 'name' => 'index_near_relation',
442 0 => 'near_relation',
444 'localizable' => FALSE,
445 'sig' => 'civicrm_relationship_vtx::0::near_relation',
448 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;