Merge pull request #15837 from totten/master-prtmpl
[civicrm-core.git] / CRM / Activity / DAO / ActivityContact.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Activity/ActivityContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
74db51d3 9 * (GenCodeChecksum:ba1318187b6445db9a639c8476eb683e)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the ActivityContact entity.
f41f0342 14 */
e501603b 15class CRM_Activity_DAO_ActivityContact extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_activity_contact';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = TRUE;
c3fc2621 30
e501603b
TO
31 /**
32 * Activity contact id
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Foreign key to the activity for this record.
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $activity_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Foreign key to the contact for this record.
47 *
e6ca0a57 48 * @var int
e501603b
TO
49 */
50 public $contact_id;
c3fc2621 51
e501603b
TO
52 /**
53 * Nature of this contact's role in the activity: 1 assignee, 2 creator, 3 focus or target.
54 *
e6ca0a57 55 * @var int
e501603b
TO
56 */
57 public $record_type_id;
c3fc2621 58
e501603b 59 /**
f41f0342 60 * Class constructor.
e501603b 61 */
c3fc2621 62 public function __construct() {
e501603b
TO
63 $this->__table = 'civicrm_activity_contact';
64 parent::__construct();
65 }
c3fc2621 66
e501603b 67 /**
f41f0342 68 * Returns foreign keys and entity references.
e501603b
TO
69 *
70 * @return array
71 * [CRM_Core_Reference_Interface]
72 */
c3fc2621 73 public static function getReferenceColumns() {
346aaaba 74 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 75 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
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');
346aaaba 78 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 79 }
346aaaba 80 return Civi::$statics[__CLASS__]['links'];
e501603b 81 }
c3fc2621 82
e501603b
TO
83 /**
84 * Returns all the column names of this table
85 *
86 * @return array
87 */
c3fc2621 88 public static function &fields() {
346aaaba 89 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
90 Civi::$statics[__CLASS__]['fields'] = [
91 'id' => [
e501603b
TO
92 'name' => 'id',
93 'type' => CRM_Utils_Type::T_INT,
c3fc2621 94 'title' => ts('Activity Contact ID'),
215b423e 95 'description' => ts('Activity contact id'),
c3fc2621 96 'required' => TRUE,
a36434b9 97 'where' => 'civicrm_activity_contact.id',
522a26c9 98 'table_name' => 'civicrm_activity_contact',
99 'entity' => 'ActivityContact',
100 'bao' => 'CRM_Activity_BAO_ActivityContact',
6a7e5e5d 101 'localizable' => 0,
c3fc2621
CW
102 ],
103 'activity_id' => [
e501603b
TO
104 'name' => 'activity_id',
105 'type' => CRM_Utils_Type::T_INT,
c3fc2621 106 'title' => ts('Activity ID'),
215b423e 107 'description' => ts('Foreign key to the activity for this record.'),
c3fc2621 108 'required' => TRUE,
a36434b9 109 'where' => 'civicrm_activity_contact.activity_id',
522a26c9 110 'table_name' => 'civicrm_activity_contact',
111 'entity' => 'ActivityContact',
112 'bao' => 'CRM_Activity_BAO_ActivityContact',
6a7e5e5d 113 'localizable' => 0,
e501603b 114 'FKClassName' => 'CRM_Activity_DAO_Activity',
c3fc2621
CW
115 ],
116 'contact_id' => [
e501603b
TO
117 'name' => 'contact_id',
118 'type' => CRM_Utils_Type::T_INT,
c3fc2621 119 'title' => ts('Contact ID (match to contact)'),
215b423e 120 'description' => ts('Foreign key to the contact for this record.'),
c3fc2621
CW
121 'required' => TRUE,
122 'import' => TRUE,
e501603b 123 'where' => 'civicrm_activity_contact.contact_id',
c3fc2621 124 'export' => TRUE,
522a26c9 125 'table_name' => 'civicrm_activity_contact',
126 'entity' => 'ActivityContact',
127 'bao' => 'CRM_Activity_BAO_ActivityContact',
6a7e5e5d 128 'localizable' => 0,
e501603b 129 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
130 ],
131 'record_type_id' => [
e501603b
TO
132 'name' => 'record_type_id',
133 'type' => CRM_Utils_Type::T_INT,
c3fc2621 134 'title' => ts('Record Type ID'),
215b423e 135 'description' => ts('Nature of this contact\'s role in the activity: 1 assignee, 2 creator, 3 focus or target.'),
a36434b9 136 'where' => 'civicrm_activity_contact.record_type_id',
522a26c9 137 'table_name' => 'civicrm_activity_contact',
138 'entity' => 'ActivityContact',
139 'bao' => 'CRM_Activity_BAO_ActivityContact',
6a7e5e5d 140 'localizable' => 0,
c3fc2621 141 'html' => [
e501603b 142 'type' => 'Select',
c3fc2621
CW
143 ],
144 'pseudoconstant' => [
e501603b
TO
145 'optionGroupName' => 'activity_contacts',
146 'optionEditPath' => 'civicrm/admin/options/activity_contacts',
e6ca0a57 147 ],
c3fc2621
CW
148 ],
149 ];
346aaaba 150 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 151 }
346aaaba 152 return Civi::$statics[__CLASS__]['fields'];
e501603b 153 }
c3fc2621 154
e501603b 155 /**
bd8e0b14 156 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
157 *
158 * @return array
bd8e0b14 159 * Array(string $name => string $uniqueName).
e501603b 160 */
c3fc2621 161 public static function &fieldKeys() {
bd8e0b14
TO
162 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
163 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 164 }
bd8e0b14 165 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 166 }
c3fc2621 167
e501603b
TO
168 /**
169 * Returns the names of this table
170 *
171 * @return string
172 */
c3fc2621 173 public static function getTableName() {
e501603b
TO
174 return self::$_tableName;
175 }
c3fc2621 176
e501603b
TO
177 /**
178 * Returns if this table needs to be logged
179 *
c3fc2621 180 * @return bool
e501603b 181 */
c3fc2621 182 public function getLog() {
e501603b
TO
183 return self::$_log;
184 }
c3fc2621 185
e501603b
TO
186 /**
187 * Returns the list of fields that can be imported
188 *
189 * @param bool $prefix
190 *
191 * @return array
192 */
c3fc2621
CW
193 public static function &import($prefix = FALSE) {
194 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity_contact', $prefix, []);
60808919 195 return $r;
e501603b 196 }
c3fc2621 197
e501603b
TO
198 /**
199 * Returns the list of fields that can be exported
200 *
201 * @param bool $prefix
202 *
203 * @return array
204 */
c3fc2621
CW
205 public static function &export($prefix = FALSE) {
206 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity_contact', $prefix, []);
60808919 207 return $r;
e501603b 208 }
c3fc2621 209
e7a6b91a
AS
210 /**
211 * Returns the list of indices
c3fc2621
CW
212 *
213 * @param bool $localize
214 *
215 * @return array
e7a6b91a
AS
216 */
217 public static function indices($localize = TRUE) {
c3fc2621
CW
218 $indices = [
219 'UI_activity_contact' => [
e7a6b91a 220 'name' => 'UI_activity_contact',
c3fc2621 221 'field' => [
e7a6b91a
AS
222 0 => 'contact_id',
223 1 => 'activity_id',
224 2 => 'record_type_id',
c3fc2621
CW
225 ],
226 'localizable' => FALSE,
227 'unique' => TRUE,
e7a6b91a 228 'sig' => 'civicrm_activity_contact::1::contact_id::activity_id::record_type_id',
c3fc2621
CW
229 ],
230 'index_record_type' => [
e7a6b91a 231 'name' => 'index_record_type',
c3fc2621 232 'field' => [
e7a6b91a
AS
233 0 => 'activity_id',
234 1 => 'record_type_id',
c3fc2621
CW
235 ],
236 'localizable' => FALSE,
e7a6b91a 237 'sig' => 'civicrm_activity_contact::0::activity_id::record_type_id',
c3fc2621
CW
238 ],
239 ];
e7a6b91a
AS
240 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
241 }
c3fc2621 242
e501603b 243}