5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Activity/ActivityContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ba1318187b6445db9a639c8476eb683e)
13 * Database access object for the ActivityContact entity.
15 class CRM_Activity_DAO_ActivityContact
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_activity_contact';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
39 * Foreign key to the activity for this record.
46 * Foreign key to the contact for this record.
53 * Nature of this contact's role in the activity: 1 assignee, 2 creator, 3 focus or target.
57 public $record_type_id;
62 public function __construct() {
63 $this->__table
= 'civicrm_activity_contact';
64 parent
::__construct();
68 * Returns foreign keys and entity references.
71 * [CRM_Core_Reference_Interface]
73 public static function getReferenceColumns() {
74 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
75 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
76 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'activity_id', 'civicrm_activity', 'id');
77 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
78 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
80 return Civi
::$statics[__CLASS__
]['links'];
84 * Returns all the column names of this table
88 public static function &fields() {
89 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
90 Civi
::$statics[__CLASS__
]['fields'] = [
93 'type' => CRM_Utils_Type
::T_INT
,
94 'title' => ts('Activity Contact ID'),
95 'description' => ts('Activity contact id'),
97 'where' => 'civicrm_activity_contact.id',
98 'table_name' => 'civicrm_activity_contact',
99 'entity' => 'ActivityContact',
100 'bao' => 'CRM_Activity_BAO_ActivityContact',
104 'name' => 'activity_id',
105 'type' => CRM_Utils_Type
::T_INT
,
106 'title' => ts('Activity ID'),
107 'description' => ts('Foreign key to the activity for this record.'),
109 'where' => 'civicrm_activity_contact.activity_id',
110 'table_name' => 'civicrm_activity_contact',
111 'entity' => 'ActivityContact',
112 'bao' => 'CRM_Activity_BAO_ActivityContact',
114 'FKClassName' => 'CRM_Activity_DAO_Activity',
117 'name' => 'contact_id',
118 'type' => CRM_Utils_Type
::T_INT
,
119 'title' => ts('Contact ID (match to contact)'),
120 'description' => ts('Foreign key to the contact for this record.'),
123 'where' => 'civicrm_activity_contact.contact_id',
125 'table_name' => 'civicrm_activity_contact',
126 'entity' => 'ActivityContact',
127 'bao' => 'CRM_Activity_BAO_ActivityContact',
129 'FKClassName' => 'CRM_Contact_DAO_Contact',
131 'record_type_id' => [
132 'name' => 'record_type_id',
133 'type' => CRM_Utils_Type
::T_INT
,
134 'title' => ts('Record Type ID'),
135 'description' => ts('Nature of this contact\'s role in the activity: 1 assignee, 2 creator, 3 focus or target.'),
136 'where' => 'civicrm_activity_contact.record_type_id',
137 'table_name' => 'civicrm_activity_contact',
138 'entity' => 'ActivityContact',
139 'bao' => 'CRM_Activity_BAO_ActivityContact',
144 'pseudoconstant' => [
145 'optionGroupName' => 'activity_contacts',
146 'optionEditPath' => 'civicrm/admin/options/activity_contacts',
150 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
152 return Civi
::$statics[__CLASS__
]['fields'];
156 * Return a mapping from field-name to the corresponding key (as used in fields()).
159 * Array(string $name => string $uniqueName).
161 public static function &fieldKeys() {
162 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
163 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
165 return Civi
::$statics[__CLASS__
]['fieldKeys'];
169 * Returns the names of this table
173 public static function getTableName() {
174 return self
::$_tableName;
178 * Returns if this table needs to be logged
182 public function getLog() {
187 * Returns the list of fields that can be imported
189 * @param bool $prefix
193 public static function &import($prefix = FALSE) {
194 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'activity_contact', $prefix, []);
199 * Returns the list of fields that can be exported
201 * @param bool $prefix
205 public static function &export($prefix = FALSE) {
206 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'activity_contact', $prefix, []);
211 * Returns the list of indices
213 * @param bool $localize
217 public static function indices($localize = TRUE) {
219 'UI_activity_contact' => [
220 'name' => 'UI_activity_contact',
224 2 => 'record_type_id',
226 'localizable' => FALSE,
228 'sig' => 'civicrm_activity_contact::1::contact_id::activity_id::record_type_id',
230 'index_record_type' => [
231 'name' => 'index_record_type',
234 1 => 'record_type_id',
236 'localizable' => FALSE,
237 'sig' => 'civicrm_activity_contact::0::activity_id::record_type_id',
240 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;