Regenerate DAO files with improved var docblocks
[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:2e8b2b826a1e0f70d39ea967462796d4)
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|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
39 */
40 public $id;
41
42 /**
43 * Foreign key to the activity for this record.
44 *
45 * @var int|string
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
48 */
49 public $activity_id;
50
51 /**
52 * Foreign key to the contact for this record.
53 *
54 * @var int|string
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
57 */
58 public $contact_id;
59
60 /**
61 * Determines the contact's role in the activity (source, target, or assignee).
62 *
63 * @var int|string|null
64 * (SQL type: int unsigned)
65 * Note that values will be retrieved from the database as a string.
66 */
67 public $record_type_id;
68
69 /**
70 * Class constructor.
71 */
72 public function __construct() {
73 $this->__table = 'civicrm_activity_contact';
74 parent::__construct();
75 }
76
77 /**
78 * Returns localized title of this entity.
79 *
80 * @param bool $plural
81 * Whether to return the plural version of the title.
82 */
83 public static function getEntityTitle($plural = FALSE) {
84 return $plural ? ts('Activity Contacts') : ts('Activity Contact');
85 }
86
87 /**
88 * Returns foreign keys and entity references.
89 *
90 * @return array
91 * [CRM_Core_Reference_Interface]
92 */
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']);
99 }
100 return Civi::$statics[__CLASS__]['links'];
101 }
102
103 /**
104 * Returns all the column names of this table
105 *
106 * @return array
107 */
108 public static function &fields() {
109 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
110 Civi::$statics[__CLASS__]['fields'] = [
111 'id' => [
112 'name' => 'id',
113 'type' => CRM_Utils_Type::T_INT,
114 'title' => ts('Activity Contact ID'),
115 'description' => ts('Activity contact id'),
116 'required' => TRUE,
117 'where' => 'civicrm_activity_contact.id',
118 'table_name' => 'civicrm_activity_contact',
119 'entity' => 'ActivityContact',
120 'bao' => 'CRM_Activity_BAO_ActivityContact',
121 'localizable' => 0,
122 'html' => [
123 'type' => 'Number',
124 ],
125 'readonly' => TRUE,
126 'add' => '4.4',
127 ],
128 'activity_id' => [
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.'),
133 'required' => TRUE,
134 'where' => 'civicrm_activity_contact.activity_id',
135 'table_name' => 'civicrm_activity_contact',
136 'entity' => 'ActivityContact',
137 'bao' => 'CRM_Activity_BAO_ActivityContact',
138 'localizable' => 0,
139 'FKClassName' => 'CRM_Activity_DAO_Activity',
140 'html' => [
141 'label' => ts("Activity"),
142 ],
143 'add' => '4.4',
144 ],
145 'contact_id' => [
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.'),
150 'required' => TRUE,
151 'import' => TRUE,
152 'where' => 'civicrm_activity_contact.contact_id',
153 'export' => TRUE,
154 'table_name' => 'civicrm_activity_contact',
155 'entity' => 'ActivityContact',
156 'bao' => 'CRM_Activity_BAO_ActivityContact',
157 'localizable' => 0,
158 'FKClassName' => 'CRM_Contact_DAO_Contact',
159 'html' => [
160 'label' => ts("Contact"),
161 ],
162 'add' => '4.4',
163 ],
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',
173 'localizable' => 0,
174 'html' => [
175 'type' => 'Select',
176 'label' => ts("Contact Role"),
177 ],
178 'pseudoconstant' => [
179 'optionGroupName' => 'activity_contacts',
180 'optionEditPath' => 'civicrm/admin/options/activity_contacts',
181 ],
182 'add' => '4.4',
183 ],
184 ];
185 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
186 }
187 return Civi::$statics[__CLASS__]['fields'];
188 }
189
190 /**
191 * Return a mapping from field-name to the corresponding key (as used in fields()).
192 *
193 * @return array
194 * Array(string $name => string $uniqueName).
195 */
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()));
199 }
200 return Civi::$statics[__CLASS__]['fieldKeys'];
201 }
202
203 /**
204 * Returns the names of this table
205 *
206 * @return string
207 */
208 public static function getTableName() {
209 return self::$_tableName;
210 }
211
212 /**
213 * Returns if this table needs to be logged
214 *
215 * @return bool
216 */
217 public function getLog() {
218 return self::$_log;
219 }
220
221 /**
222 * Returns the list of fields that can be imported
223 *
224 * @param bool $prefix
225 *
226 * @return array
227 */
228 public static function &import($prefix = FALSE) {
229 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity_contact', $prefix, []);
230 return $r;
231 }
232
233 /**
234 * Returns the list of fields that can be exported
235 *
236 * @param bool $prefix
237 *
238 * @return array
239 */
240 public static function &export($prefix = FALSE) {
241 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity_contact', $prefix, []);
242 return $r;
243 }
244
245 /**
246 * Returns the list of indices
247 *
248 * @param bool $localize
249 *
250 * @return array
251 */
252 public static function indices($localize = TRUE) {
253 $indices = [
254 'UI_activity_contact' => [
255 'name' => 'UI_activity_contact',
256 'field' => [
257 0 => 'contact_id',
258 1 => 'activity_id',
259 2 => 'record_type_id',
260 ],
261 'localizable' => FALSE,
262 'unique' => TRUE,
263 'sig' => 'civicrm_activity_contact::1::contact_id::activity_id::record_type_id',
264 ],
265 'index_record_type' => [
266 'name' => 'index_record_type',
267 'field' => [
268 0 => 'activity_id',
269 1 => 'record_type_id',
270 ],
271 'localizable' => FALSE,
272 'sig' => 'civicrm_activity_contact::0::activity_id::record_type_id',
273 ],
274 ];
275 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
276 }
277
278 }