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:e713c308a3c7d44cb334af9c97b9939e)
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 * Determines the contact's role in the activity (source, target, or assignee).
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.
73 * Whether to return the plural version of the title.
75 public static function getEntityTitle($plural = FALSE) {
76 return $plural ?
ts('Activity Contacts') : ts('Activity Contact');
80 * Returns foreign keys and entity references.
83 * [CRM_Core_Reference_Interface]
85 public static function getReferenceColumns() {
86 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
87 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
88 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'activity_id', 'civicrm_activity', 'id');
89 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
90 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
92 return Civi
::$statics[__CLASS__
]['links'];
96 * Returns all the column names of this table
100 public static function &fields() {
101 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
102 Civi
::$statics[__CLASS__
]['fields'] = [
105 'type' => CRM_Utils_Type
::T_INT
,
106 'title' => ts('Activity Contact ID'),
107 'description' => ts('Activity contact id'),
109 'where' => 'civicrm_activity_contact.id',
110 'table_name' => 'civicrm_activity_contact',
111 'entity' => 'ActivityContact',
112 'bao' => 'CRM_Activity_BAO_ActivityContact',
120 'name' => 'activity_id',
121 'type' => CRM_Utils_Type
::T_INT
,
122 'title' => ts('Activity ID'),
123 'description' => ts('Foreign key to the activity for this record.'),
125 'where' => 'civicrm_activity_contact.activity_id',
126 'table_name' => 'civicrm_activity_contact',
127 'entity' => 'ActivityContact',
128 'bao' => 'CRM_Activity_BAO_ActivityContact',
130 'FKClassName' => 'CRM_Activity_DAO_Activity',
132 'label' => ts("Activity"),
137 'name' => 'contact_id',
138 'type' => CRM_Utils_Type
::T_INT
,
139 'title' => ts('Contact ID'),
140 'description' => ts('Foreign key to the contact for this record.'),
143 'where' => 'civicrm_activity_contact.contact_id',
145 'table_name' => 'civicrm_activity_contact',
146 'entity' => 'ActivityContact',
147 'bao' => 'CRM_Activity_BAO_ActivityContact',
149 'FKClassName' => 'CRM_Contact_DAO_Contact',
151 'label' => ts("Contact"),
155 'record_type_id' => [
156 'name' => 'record_type_id',
157 'type' => CRM_Utils_Type
::T_INT
,
158 'title' => ts('Activity Contact Type'),
159 'description' => ts('Determines the contact\'s role in the activity (source, target, or assignee).'),
160 'where' => 'civicrm_activity_contact.record_type_id',
161 'table_name' => 'civicrm_activity_contact',
162 'entity' => 'ActivityContact',
163 'bao' => 'CRM_Activity_BAO_ActivityContact',
167 'label' => ts("Contact Role"),
169 'pseudoconstant' => [
170 'optionGroupName' => 'activity_contacts',
171 'optionEditPath' => 'civicrm/admin/options/activity_contacts',
176 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
178 return Civi
::$statics[__CLASS__
]['fields'];
182 * Return a mapping from field-name to the corresponding key (as used in fields()).
185 * Array(string $name => string $uniqueName).
187 public static function &fieldKeys() {
188 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
189 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
191 return Civi
::$statics[__CLASS__
]['fieldKeys'];
195 * Returns the names of this table
199 public static function getTableName() {
200 return self
::$_tableName;
204 * Returns if this table needs to be logged
208 public function getLog() {
213 * Returns the list of fields that can be imported
215 * @param bool $prefix
219 public static function &import($prefix = FALSE) {
220 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'activity_contact', $prefix, []);
225 * Returns the list of fields that can be exported
227 * @param bool $prefix
231 public static function &export($prefix = FALSE) {
232 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'activity_contact', $prefix, []);
237 * Returns the list of indices
239 * @param bool $localize
243 public static function indices($localize = TRUE) {
245 'UI_activity_contact' => [
246 'name' => 'UI_activity_contact',
250 2 => 'record_type_id',
252 'localizable' => FALSE,
254 'sig' => 'civicrm_activity_contact::1::contact_id::activity_id::record_type_id',
256 'index_record_type' => [
257 'name' => 'index_record_type',
260 1 => 'record_type_id',
262 'localizable' => FALSE,
263 'sig' => 'civicrm_activity_contact::0::activity_id::record_type_id',
266 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;