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