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:777598f3625dfeaf37a81de282808c60)
13 * Database access object for the ActivityContact entity.
15 class CRM_Activity_DAO_ActivityContact
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '4.4';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_activity_contact';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
41 * Foreign key to the activity for this record.
48 * Foreign key to the contact for this record.
55 * Nature of this contact's role in the activity: 1 assignee, 2 creator, 3 focus or target.
59 public $record_type_id;
64 public function __construct() {
65 $this->__table
= 'civicrm_activity_contact';
66 parent
::__construct();
70 * Returns localized title of this entity.
72 public static function getEntityTitle() {
73 return ts('Activity Contacts');
77 * Returns foreign keys and entity references.
80 * [CRM_Core_Reference_Interface]
82 public static function getReferenceColumns() {
83 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
84 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
85 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'activity_id', 'civicrm_activity', 'id');
86 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
87 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
89 return Civi
::$statics[__CLASS__
]['links'];
93 * Returns all the column names of this table
97 public static function &fields() {
98 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
99 Civi
::$statics[__CLASS__
]['fields'] = [
102 'type' => CRM_Utils_Type
::T_INT
,
103 'title' => ts('Activity Contact ID'),
104 'description' => ts('Activity contact id'),
106 'where' => 'civicrm_activity_contact.id',
107 'table_name' => 'civicrm_activity_contact',
108 'entity' => 'ActivityContact',
109 'bao' => 'CRM_Activity_BAO_ActivityContact',
114 'name' => 'activity_id',
115 'type' => CRM_Utils_Type
::T_INT
,
116 'title' => ts('Activity ID'),
117 'description' => ts('Foreign key to the activity for this record.'),
119 'where' => 'civicrm_activity_contact.activity_id',
120 'table_name' => 'civicrm_activity_contact',
121 'entity' => 'ActivityContact',
122 'bao' => 'CRM_Activity_BAO_ActivityContact',
124 'FKClassName' => 'CRM_Activity_DAO_Activity',
128 'name' => 'contact_id',
129 'type' => CRM_Utils_Type
::T_INT
,
130 'title' => ts('Contact ID (match to contact)'),
131 'description' => ts('Foreign key to the contact for this record.'),
134 'where' => 'civicrm_activity_contact.contact_id',
136 'table_name' => 'civicrm_activity_contact',
137 'entity' => 'ActivityContact',
138 'bao' => 'CRM_Activity_BAO_ActivityContact',
140 'FKClassName' => 'CRM_Contact_DAO_Contact',
143 'record_type_id' => [
144 'name' => 'record_type_id',
145 'type' => CRM_Utils_Type
::T_INT
,
146 'title' => ts('Record Type ID'),
147 'description' => ts('Nature of this contact\'s role in the activity: 1 assignee, 2 creator, 3 focus or target.'),
148 'where' => 'civicrm_activity_contact.record_type_id',
149 'table_name' => 'civicrm_activity_contact',
150 'entity' => 'ActivityContact',
151 'bao' => 'CRM_Activity_BAO_ActivityContact',
156 'pseudoconstant' => [
157 'optionGroupName' => 'activity_contacts',
158 'optionEditPath' => 'civicrm/admin/options/activity_contacts',
163 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
165 return Civi
::$statics[__CLASS__
]['fields'];
169 * Return a mapping from field-name to the corresponding key (as used in fields()).
172 * Array(string $name => string $uniqueName).
174 public static function &fieldKeys() {
175 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
176 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
178 return Civi
::$statics[__CLASS__
]['fieldKeys'];
182 * Returns the names of this table
186 public static function getTableName() {
187 return self
::$_tableName;
191 * Returns if this table needs to be logged
195 public function getLog() {
200 * Returns the list of fields that can be imported
202 * @param bool $prefix
206 public static function &import($prefix = FALSE) {
207 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'activity_contact', $prefix, []);
212 * Returns the list of fields that can be exported
214 * @param bool $prefix
218 public static function &export($prefix = FALSE) {
219 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'activity_contact', $prefix, []);
224 * Returns the list of indices
226 * @param bool $localize
230 public static function indices($localize = TRUE) {
232 'UI_activity_contact' => [
233 'name' => 'UI_activity_contact',
237 2 => 'record_type_id',
239 'localizable' => FALSE,
241 'sig' => 'civicrm_activity_contact::1::contact_id::activity_id::record_type_id',
243 'index_record_type' => [
244 'name' => 'index_record_type',
247 1 => 'record_type_id',
249 'localizable' => FALSE,
250 'sig' => 'civicrm_activity_contact::0::activity_id::record_type_id',
253 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;