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:2e8b2b826a1e0f70d39ea967462796d4)
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;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Foreign key to the activity for this record.
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
52 * Foreign key to the contact for this record.
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
61 * Determines the contact's role in the activity (source, target, or assignee).
63 * @var int|string|null
64 * (SQL type: int unsigned)
65 * Note that values will be retrieved from the database as a string.
67 public $record_type_id;
72 public function __construct() {
73 $this->__table
= 'civicrm_activity_contact';
74 parent
::__construct();
78 * Returns localized title of this entity.
81 * Whether to return the plural version of the title.
83 public static function getEntityTitle($plural = FALSE) {
84 return $plural ?
ts('Activity Contacts') : ts('Activity Contact');
88 * Returns foreign keys and entity references.
91 * [CRM_Core_Reference_Interface]
93 public static function getReferenceColumns() {
94 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
95 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
96 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'activity_id', 'civicrm_activity', 'id');
97 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
98 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
100 return Civi
::$statics[__CLASS__
]['links'];
104 * Returns all the column names of this table
108 public static function &fields() {
109 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
110 Civi
::$statics[__CLASS__
]['fields'] = [
113 'type' => CRM_Utils_Type
::T_INT
,
114 'title' => ts('Activity Contact ID'),
115 'description' => ts('Activity contact id'),
117 'where' => 'civicrm_activity_contact.id',
118 'table_name' => 'civicrm_activity_contact',
119 'entity' => 'ActivityContact',
120 'bao' => 'CRM_Activity_BAO_ActivityContact',
129 'name' => 'activity_id',
130 'type' => CRM_Utils_Type
::T_INT
,
131 'title' => ts('Activity ID'),
132 'description' => ts('Foreign key to the activity for this record.'),
134 'where' => 'civicrm_activity_contact.activity_id',
135 'table_name' => 'civicrm_activity_contact',
136 'entity' => 'ActivityContact',
137 'bao' => 'CRM_Activity_BAO_ActivityContact',
139 'FKClassName' => 'CRM_Activity_DAO_Activity',
141 'label' => ts("Activity"),
146 'name' => 'contact_id',
147 'type' => CRM_Utils_Type
::T_INT
,
148 'title' => ts('Contact ID'),
149 'description' => ts('Foreign key to the contact for this record.'),
152 'where' => 'civicrm_activity_contact.contact_id',
154 'table_name' => 'civicrm_activity_contact',
155 'entity' => 'ActivityContact',
156 'bao' => 'CRM_Activity_BAO_ActivityContact',
158 'FKClassName' => 'CRM_Contact_DAO_Contact',
160 'label' => ts("Contact"),
164 'record_type_id' => [
165 'name' => 'record_type_id',
166 'type' => CRM_Utils_Type
::T_INT
,
167 'title' => ts('Activity Contact Type'),
168 'description' => ts('Determines the contact\'s role in the activity (source, target, or assignee).'),
169 'where' => 'civicrm_activity_contact.record_type_id',
170 'table_name' => 'civicrm_activity_contact',
171 'entity' => 'ActivityContact',
172 'bao' => 'CRM_Activity_BAO_ActivityContact',
176 'label' => ts("Contact Role"),
178 'pseudoconstant' => [
179 'optionGroupName' => 'activity_contacts',
180 'optionEditPath' => 'civicrm/admin/options/activity_contacts',
185 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
187 return Civi
::$statics[__CLASS__
]['fields'];
191 * Return a mapping from field-name to the corresponding key (as used in fields()).
194 * Array(string $name => string $uniqueName).
196 public static function &fieldKeys() {
197 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
198 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
200 return Civi
::$statics[__CLASS__
]['fieldKeys'];
204 * Returns the names of this table
208 public static function getTableName() {
209 return self
::$_tableName;
213 * Returns if this table needs to be logged
217 public function getLog() {
222 * Returns the list of fields that can be imported
224 * @param bool $prefix
228 public static function &import($prefix = FALSE) {
229 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'activity_contact', $prefix, []);
234 * Returns the list of fields that can be exported
236 * @param bool $prefix
240 public static function &export($prefix = FALSE) {
241 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'activity_contact', $prefix, []);
246 * Returns the list of indices
248 * @param bool $localize
252 public static function indices($localize = TRUE) {
254 'UI_activity_contact' => [
255 'name' => 'UI_activity_contact',
259 2 => 'record_type_id',
261 'localizable' => FALSE,
263 'sig' => 'civicrm_activity_contact::1::contact_id::activity_id::record_type_id',
265 'index_record_type' => [
266 'name' => 'index_record_type',
269 1 => 'record_type_id',
271 'localizable' => FALSE,
272 'sig' => 'civicrm_activity_contact::0::activity_id::record_type_id',
275 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;