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