CodeGen - Add EXT and TABLE_ADDED to each DAO file
[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
a9d0587b 9 * (GenCodeChecksum:b458f04c2195968dbc9d49f35f7abb70)
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
449c4e6b
CW
67 /**
68 * Returns localized title of this entity.
69 */
70 public static function getEntityTitle() {
71 return ts('Activity Contacts');
72 }
73
e501603b 74 /**
f41f0342 75 * Returns foreign keys and entity references.
e501603b
TO
76 *
77 * @return array
78 * [CRM_Core_Reference_Interface]
79 */
c3fc2621 80 public static function getReferenceColumns() {
346aaaba 81 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 82 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
83 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'activity_id', 'civicrm_activity', 'id');
84 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
346aaaba 85 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 86 }
346aaaba 87 return Civi::$statics[__CLASS__]['links'];
e501603b 88 }
c3fc2621 89
e501603b
TO
90 /**
91 * Returns all the column names of this table
92 *
93 * @return array
94 */
c3fc2621 95 public static function &fields() {
346aaaba 96 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
97 Civi::$statics[__CLASS__]['fields'] = [
98 'id' => [
e501603b
TO
99 'name' => 'id',
100 'type' => CRM_Utils_Type::T_INT,
c3fc2621 101 'title' => ts('Activity Contact ID'),
215b423e 102 'description' => ts('Activity contact id'),
c3fc2621 103 'required' => TRUE,
a36434b9 104 'where' => 'civicrm_activity_contact.id',
522a26c9 105 'table_name' => 'civicrm_activity_contact',
106 'entity' => 'ActivityContact',
107 'bao' => 'CRM_Activity_BAO_ActivityContact',
6a7e5e5d 108 'localizable' => 0,
a9d0587b 109 'add' => '4.4',
c3fc2621
CW
110 ],
111 'activity_id' => [
e501603b
TO
112 'name' => 'activity_id',
113 'type' => CRM_Utils_Type::T_INT,
c3fc2621 114 'title' => ts('Activity ID'),
215b423e 115 'description' => ts('Foreign key to the activity for this record.'),
c3fc2621 116 'required' => TRUE,
a36434b9 117 'where' => 'civicrm_activity_contact.activity_id',
522a26c9 118 'table_name' => 'civicrm_activity_contact',
119 'entity' => 'ActivityContact',
120 'bao' => 'CRM_Activity_BAO_ActivityContact',
6a7e5e5d 121 'localizable' => 0,
e501603b 122 'FKClassName' => 'CRM_Activity_DAO_Activity',
a9d0587b 123 'add' => '4.4',
c3fc2621
CW
124 ],
125 'contact_id' => [
e501603b
TO
126 'name' => 'contact_id',
127 'type' => CRM_Utils_Type::T_INT,
c3fc2621 128 'title' => ts('Contact ID (match to contact)'),
215b423e 129 'description' => ts('Foreign key to the contact for this record.'),
c3fc2621
CW
130 'required' => TRUE,
131 'import' => TRUE,
e501603b 132 'where' => 'civicrm_activity_contact.contact_id',
c3fc2621 133 'export' => TRUE,
522a26c9 134 'table_name' => 'civicrm_activity_contact',
135 'entity' => 'ActivityContact',
136 'bao' => 'CRM_Activity_BAO_ActivityContact',
6a7e5e5d 137 'localizable' => 0,
e501603b 138 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 139 'add' => '4.4',
c3fc2621
CW
140 ],
141 'record_type_id' => [
e501603b
TO
142 'name' => 'record_type_id',
143 'type' => CRM_Utils_Type::T_INT,
c3fc2621 144 'title' => ts('Record Type ID'),
215b423e 145 'description' => ts('Nature of this contact\'s role in the activity: 1 assignee, 2 creator, 3 focus or target.'),
a36434b9 146 'where' => 'civicrm_activity_contact.record_type_id',
522a26c9 147 'table_name' => 'civicrm_activity_contact',
148 'entity' => 'ActivityContact',
149 'bao' => 'CRM_Activity_BAO_ActivityContact',
6a7e5e5d 150 'localizable' => 0,
c3fc2621 151 'html' => [
e501603b 152 'type' => 'Select',
c3fc2621
CW
153 ],
154 'pseudoconstant' => [
e501603b
TO
155 'optionGroupName' => 'activity_contacts',
156 'optionEditPath' => 'civicrm/admin/options/activity_contacts',
e6ca0a57 157 ],
a9d0587b 158 'add' => '4.4',
c3fc2621
CW
159 ],
160 ];
346aaaba 161 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 162 }
346aaaba 163 return Civi::$statics[__CLASS__]['fields'];
e501603b 164 }
c3fc2621 165
e501603b 166 /**
bd8e0b14 167 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
168 *
169 * @return array
bd8e0b14 170 * Array(string $name => string $uniqueName).
e501603b 171 */
c3fc2621 172 public static function &fieldKeys() {
bd8e0b14
TO
173 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
174 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 175 }
bd8e0b14 176 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 177 }
c3fc2621 178
e501603b
TO
179 /**
180 * Returns the names of this table
181 *
182 * @return string
183 */
c3fc2621 184 public static function getTableName() {
e501603b
TO
185 return self::$_tableName;
186 }
c3fc2621 187
e501603b
TO
188 /**
189 * Returns if this table needs to be logged
190 *
c3fc2621 191 * @return bool
e501603b 192 */
c3fc2621 193 public function getLog() {
e501603b
TO
194 return self::$_log;
195 }
c3fc2621 196
e501603b
TO
197 /**
198 * Returns the list of fields that can be imported
199 *
200 * @param bool $prefix
201 *
202 * @return array
203 */
c3fc2621
CW
204 public static function &import($prefix = FALSE) {
205 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity_contact', $prefix, []);
60808919 206 return $r;
e501603b 207 }
c3fc2621 208
e501603b
TO
209 /**
210 * Returns the list of fields that can be exported
211 *
212 * @param bool $prefix
213 *
214 * @return array
215 */
c3fc2621
CW
216 public static function &export($prefix = FALSE) {
217 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity_contact', $prefix, []);
60808919 218 return $r;
e501603b 219 }
c3fc2621 220
e7a6b91a
AS
221 /**
222 * Returns the list of indices
c3fc2621
CW
223 *
224 * @param bool $localize
225 *
226 * @return array
e7a6b91a
AS
227 */
228 public static function indices($localize = TRUE) {
c3fc2621
CW
229 $indices = [
230 'UI_activity_contact' => [
e7a6b91a 231 'name' => 'UI_activity_contact',
c3fc2621 232 'field' => [
e7a6b91a
AS
233 0 => 'contact_id',
234 1 => 'activity_id',
235 2 => 'record_type_id',
c3fc2621
CW
236 ],
237 'localizable' => FALSE,
238 'unique' => TRUE,
e7a6b91a 239 'sig' => 'civicrm_activity_contact::1::contact_id::activity_id::record_type_id',
c3fc2621
CW
240 ],
241 'index_record_type' => [
e7a6b91a 242 'name' => 'index_record_type',
c3fc2621 243 'field' => [
e7a6b91a
AS
244 0 => 'activity_id',
245 1 => 'record_type_id',
c3fc2621
CW
246 ],
247 'localizable' => FALSE,
e7a6b91a 248 'sig' => 'civicrm_activity_contact::0::activity_id::record_type_id',
c3fc2621
CW
249 ],
250 ];
e7a6b91a
AS
251 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
252 }
c3fc2621 253
e501603b 254}