5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Activity/ActivityContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:7a410e20f48318deeb83f3dd1900983a)
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 static $_tableName = 'civicrm_activity_contact';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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' => 'Activity contact id',
97 'table_name' => 'civicrm_activity_contact',
98 'entity' => 'ActivityContact',
99 'bao' => 'CRM_Activity_BAO_ActivityContact',
103 'name' => 'activity_id',
104 'type' => CRM_Utils_Type
::T_INT
,
105 'title' => ts('Activity ID'),
106 'description' => 'Foreign key to the activity for this record.',
108 'table_name' => 'civicrm_activity_contact',
109 'entity' => 'ActivityContact',
110 'bao' => 'CRM_Activity_BAO_ActivityContact',
112 'FKClassName' => 'CRM_Activity_DAO_Activity',
115 'name' => 'contact_id',
116 'type' => CRM_Utils_Type
::T_INT
,
117 'title' => ts('Contact ID (match to contact)'),
118 'description' => 'Foreign key to the contact for this record.',
121 'where' => 'civicrm_activity_contact.contact_id',
122 'headerPattern' => '',
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' => 'Nature of this contact\'s role in the activity: 1 assignee, 2 creator, 3 focus or target.',
136 'table_name' => 'civicrm_activity_contact',
137 'entity' => 'ActivityContact',
138 'bao' => 'CRM_Activity_BAO_ActivityContact',
143 'pseudoconstant' => [
144 'optionGroupName' => 'activity_contacts',
145 'optionEditPath' => 'civicrm/admin/options/activity_contacts',
149 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
151 return Civi
::$statics[__CLASS__
]['fields'];
155 * Return a mapping from field-name to the corresponding key (as used in fields()).
158 * Array(string $name => string $uniqueName).
160 public static function &fieldKeys() {
161 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
162 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
164 return Civi
::$statics[__CLASS__
]['fieldKeys'];
168 * Returns the names of this table
172 public static function getTableName() {
173 return self
::$_tableName;
177 * Returns if this table needs to be logged
181 public function getLog() {
186 * Returns the list of fields that can be imported
188 * @param bool $prefix
192 public static function &import($prefix = FALSE) {
193 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'activity_contact', $prefix, []);
198 * Returns the list of fields that can be exported
200 * @param bool $prefix
204 public static function &export($prefix = FALSE) {
205 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'activity_contact', $prefix, []);
210 * Returns the list of indices
212 * @param bool $localize
216 public static function indices($localize = TRUE) {
218 'UI_activity_contact' => [
219 'name' => 'UI_activity_contact',
223 2 => 'record_type_id',
225 'localizable' => FALSE,
227 'sig' => 'civicrm_activity_contact::1::contact_id::activity_id::record_type_id',
229 'index_record_type' => [
230 'name' => 'index_record_type',
233 1 => 'record_type_id',
235 'localizable' => FALSE,
236 'sig' => 'civicrm_activity_contact::0::activity_id::record_type_id',
239 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;