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