Merge pull request #11453 from colemanw/php55
[civicrm-core.git] / CRM / Activity / DAO / ActivityContact.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Activity/ActivityContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:7a410e20f48318deeb83f3dd1900983a)
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 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 static $_log = TRUE;
30
31 /**
32 * Activity contact id
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Foreign key to the activity for this record.
40 *
41 * @var int unsigned
42 */
43 public $activity_id;
44
45 /**
46 * Foreign key to the contact for this record.
47 *
48 * @var int unsigned
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 unsigned
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' => 'Activity contact id',
96 'required' => TRUE,
97 'table_name' => 'civicrm_activity_contact',
98 'entity' => 'ActivityContact',
99 'bao' => 'CRM_Activity_BAO_ActivityContact',
100 'localizable' => 0,
101 ],
102 'activity_id' => [
103 'name' => 'activity_id',
104 'type' => CRM_Utils_Type::T_INT,
105 'title' => ts('Activity ID'),
106 'description' => 'Foreign key to the activity for this record.',
107 'required' => TRUE,
108 'table_name' => 'civicrm_activity_contact',
109 'entity' => 'ActivityContact',
110 'bao' => 'CRM_Activity_BAO_ActivityContact',
111 'localizable' => 0,
112 'FKClassName' => 'CRM_Activity_DAO_Activity',
113 ],
114 'contact_id' => [
115 'name' => 'contact_id',
116 'type' => CRM_Utils_Type::T_INT,
117 'title' => ts('Contact ID (match to contact)'),
118 'description' => 'Foreign key to the contact for this record.',
119 'required' => TRUE,
120 'import' => TRUE,
121 'where' => 'civicrm_activity_contact.contact_id',
122 'headerPattern' => '',
123 'dataPattern' => '',
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' => 'Nature of this contact\'s role in the activity: 1 assignee, 2 creator, 3 focus or target.',
136 'table_name' => 'civicrm_activity_contact',
137 'entity' => 'ActivityContact',
138 'bao' => 'CRM_Activity_BAO_ActivityContact',
139 'localizable' => 0,
140 'html' => [
141 'type' => 'Select',
142 ],
143 'pseudoconstant' => [
144 'optionGroupName' => 'activity_contacts',
145 'optionEditPath' => 'civicrm/admin/options/activity_contacts',
146 ]
147 ],
148 ];
149 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
150 }
151 return Civi::$statics[__CLASS__]['fields'];
152 }
153
154 /**
155 * Return a mapping from field-name to the corresponding key (as used in fields()).
156 *
157 * @return array
158 * Array(string $name => string $uniqueName).
159 */
160 public static function &fieldKeys() {
161 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
162 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
163 }
164 return Civi::$statics[__CLASS__]['fieldKeys'];
165 }
166
167 /**
168 * Returns the names of this table
169 *
170 * @return string
171 */
172 public static function getTableName() {
173 return self::$_tableName;
174 }
175
176 /**
177 * Returns if this table needs to be logged
178 *
179 * @return bool
180 */
181 public function getLog() {
182 return self::$_log;
183 }
184
185 /**
186 * Returns the list of fields that can be imported
187 *
188 * @param bool $prefix
189 *
190 * @return array
191 */
192 public static function &import($prefix = FALSE) {
193 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity_contact', $prefix, []);
194 return $r;
195 }
196
197 /**
198 * Returns the list of fields that can be exported
199 *
200 * @param bool $prefix
201 *
202 * @return array
203 */
204 public static function &export($prefix = FALSE) {
205 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity_contact', $prefix, []);
206 return $r;
207 }
208
209 /**
210 * Returns the list of indices
211 *
212 * @param bool $localize
213 *
214 * @return array
215 */
216 public static function indices($localize = TRUE) {
217 $indices = [
218 'UI_activity_contact' => [
219 'name' => 'UI_activity_contact',
220 'field' => [
221 0 => 'contact_id',
222 1 => 'activity_id',
223 2 => 'record_type_id',
224 ],
225 'localizable' => FALSE,
226 'unique' => TRUE,
227 'sig' => 'civicrm_activity_contact::1::contact_id::activity_id::record_type_id',
228 ],
229 'index_record_type' => [
230 'name' => 'index_record_type',
231 'field' => [
232 0 => 'activity_id',
233 1 => 'record_type_id',
234 ],
235 'localizable' => FALSE,
236 'sig' => 'civicrm_activity_contact::0::activity_id::record_type_id',
237 ],
238 ];
239 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
240 }
241
242 }