Merge pull request #18794 from eileenmcnaughton/need_less
[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:3f147b2507b1e11a7df971be191161d1)
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 * Nature of this contact's role in the activity: 1 assignee, 2 creator, 3 focus or target.
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 'add' => '4.4',
115 ],
116 'activity_id' => [
117 'name' => 'activity_id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('Activity ID'),
120 'description' => ts('Foreign key to the activity for this record.'),
121 'required' => TRUE,
122 'where' => 'civicrm_activity_contact.activity_id',
123 'table_name' => 'civicrm_activity_contact',
124 'entity' => 'ActivityContact',
125 'bao' => 'CRM_Activity_BAO_ActivityContact',
126 'localizable' => 0,
127 'FKClassName' => 'CRM_Activity_DAO_Activity',
128 'add' => '4.4',
129 ],
130 'contact_id' => [
131 'name' => 'contact_id',
132 'type' => CRM_Utils_Type::T_INT,
133 'title' => ts('Contact ID (match to contact)'),
134 'description' => ts('Foreign key to the contact for this record.'),
135 'required' => TRUE,
136 'import' => TRUE,
137 'where' => 'civicrm_activity_contact.contact_id',
138 'export' => TRUE,
139 'table_name' => 'civicrm_activity_contact',
140 'entity' => 'ActivityContact',
141 'bao' => 'CRM_Activity_BAO_ActivityContact',
142 'localizable' => 0,
143 'FKClassName' => 'CRM_Contact_DAO_Contact',
144 'add' => '4.4',
145 ],
146 'record_type_id' => [
147 'name' => 'record_type_id',
148 'type' => CRM_Utils_Type::T_INT,
149 'title' => ts('Record Type ID'),
150 'description' => ts('Nature of this contact\'s role in the activity: 1 assignee, 2 creator, 3 focus or target.'),
151 'where' => 'civicrm_activity_contact.record_type_id',
152 'table_name' => 'civicrm_activity_contact',
153 'entity' => 'ActivityContact',
154 'bao' => 'CRM_Activity_BAO_ActivityContact',
155 'localizable' => 0,
156 'html' => [
157 'type' => 'Select',
158 ],
159 'pseudoconstant' => [
160 'optionGroupName' => 'activity_contacts',
161 'optionEditPath' => 'civicrm/admin/options/activity_contacts',
162 ],
163 'add' => '4.4',
164 ],
165 ];
166 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
167 }
168 return Civi::$statics[__CLASS__]['fields'];
169 }
170
171 /**
172 * Return a mapping from field-name to the corresponding key (as used in fields()).
173 *
174 * @return array
175 * Array(string $name => string $uniqueName).
176 */
177 public static function &fieldKeys() {
178 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
179 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
180 }
181 return Civi::$statics[__CLASS__]['fieldKeys'];
182 }
183
184 /**
185 * Returns the names of this table
186 *
187 * @return string
188 */
189 public static function getTableName() {
190 return self::$_tableName;
191 }
192
193 /**
194 * Returns if this table needs to be logged
195 *
196 * @return bool
197 */
198 public function getLog() {
199 return self::$_log;
200 }
201
202 /**
203 * Returns the list of fields that can be imported
204 *
205 * @param bool $prefix
206 *
207 * @return array
208 */
209 public static function &import($prefix = FALSE) {
210 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity_contact', $prefix, []);
211 return $r;
212 }
213
214 /**
215 * Returns the list of fields that can be exported
216 *
217 * @param bool $prefix
218 *
219 * @return array
220 */
221 public static function &export($prefix = FALSE) {
222 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity_contact', $prefix, []);
223 return $r;
224 }
225
226 /**
227 * Returns the list of indices
228 *
229 * @param bool $localize
230 *
231 * @return array
232 */
233 public static function indices($localize = TRUE) {
234 $indices = [
235 'UI_activity_contact' => [
236 'name' => 'UI_activity_contact',
237 'field' => [
238 0 => 'contact_id',
239 1 => 'activity_id',
240 2 => 'record_type_id',
241 ],
242 'localizable' => FALSE,
243 'unique' => TRUE,
244 'sig' => 'civicrm_activity_contact::1::contact_id::activity_id::record_type_id',
245 ],
246 'index_record_type' => [
247 'name' => 'index_record_type',
248 'field' => [
249 0 => 'activity_id',
250 1 => 'record_type_id',
251 ],
252 'localizable' => FALSE,
253 'sig' => 'civicrm_activity_contact::0::activity_id::record_type_id',
254 ],
255 ];
256 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
257 }
258
259 }