Merge pull request #19159 from colemanw/api4DynamicJoinFix
[civicrm-core.git] / CRM / Core / DAO / ActionLog.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/ActionLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
d31fb4e3 9 * (GenCodeChecksum:5e54867f6cec000d7f219c82a1c081d3)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the ActionLog entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_ActionLog extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.4';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_action_log';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b 33 /**
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * FK to Contact ID
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $contact_id;
c3fc2621 44
e501603b
TO
45 /**
46 * FK to id of the entity that the action was performed on. Pseudo - FK.
47 *
e6ca0a57 48 * @var int
e501603b
TO
49 */
50 public $entity_id;
c3fc2621 51
e501603b
TO
52 /**
53 * name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant
54 *
55 * @var string
56 */
57 public $entity_table;
c3fc2621 58
e501603b
TO
59 /**
60 * FK to the action schedule that this action originated from.
61 *
e6ca0a57 62 * @var int
e501603b
TO
63 */
64 public $action_schedule_id;
c3fc2621 65
e501603b
TO
66 /**
67 * date time that the action was performed on.
68 *
69 * @var datetime
70 */
71 public $action_date_time;
c3fc2621 72
e501603b
TO
73 /**
74 * Was there any error sending the reminder?
75 *
e6ca0a57 76 * @var bool
e501603b
TO
77 */
78 public $is_error;
c3fc2621 79
e501603b
TO
80 /**
81 * Description / text in case there was an error encountered.
82 *
83 * @var text
84 */
85 public $message;
c3fc2621 86
e501603b
TO
87 /**
88 * Keeps track of the sequence number of this repetition.
89 *
e6ca0a57 90 * @var int
e501603b
TO
91 */
92 public $repetition_number;
c3fc2621 93
e501603b
TO
94 /**
95 * Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)
96 *
74db51d3 97 * @var datetime
e501603b
TO
98 */
99 public $reference_date;
c3fc2621 100
e501603b 101 /**
f41f0342 102 * Class constructor.
e501603b 103 */
c3fc2621 104 public function __construct() {
e501603b
TO
105 $this->__table = 'civicrm_action_log';
106 parent::__construct();
107 }
c3fc2621 108
449c4e6b
CW
109 /**
110 * Returns localized title of this entity.
7b66c3b5
AH
111 *
112 * @param bool $plural
113 * Whether to return the plural version of the title.
449c4e6b 114 */
7b66c3b5
AH
115 public static function getEntityTitle($plural = FALSE) {
116 return $plural ? ts('Action Logs') : ts('Action Log');
449c4e6b
CW
117 }
118
e501603b 119 /**
f41f0342 120 * Returns foreign keys and entity references.
e501603b
TO
121 *
122 * @return array
123 * [CRM_Core_Reference_Interface]
124 */
c3fc2621 125 public static function getReferenceColumns() {
346aaaba 126 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 127 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
128 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
129 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'action_schedule_id', 'civicrm_action_schedule', 'id');
130 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 131 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 132 }
346aaaba 133 return Civi::$statics[__CLASS__]['links'];
e501603b 134 }
c3fc2621 135
e501603b
TO
136 /**
137 * Returns all the column names of this table
138 *
139 * @return array
140 */
c3fc2621 141 public static function &fields() {
346aaaba 142 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
143 Civi::$statics[__CLASS__]['fields'] = [
144 'id' => [
e501603b
TO
145 'name' => 'id',
146 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
147 'title' => ts('Action Schedule ID'),
148 'required' => TRUE,
a36434b9 149 'where' => 'civicrm_action_log.id',
522a26c9 150 'table_name' => 'civicrm_action_log',
151 'entity' => 'ActionLog',
152 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 153 'localizable' => 0,
a9d0587b 154 'add' => '3.4',
c3fc2621
CW
155 ],
156 'contact_id' => [
e501603b
TO
157 'name' => 'contact_id',
158 'type' => CRM_Utils_Type::T_INT,
c3fc2621 159 'title' => ts('Action Schedule Contact ID'),
215b423e 160 'description' => ts('FK to Contact ID'),
a36434b9 161 'where' => 'civicrm_action_log.contact_id',
522a26c9 162 'table_name' => 'civicrm_action_log',
163 'entity' => 'ActionLog',
164 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 165 'localizable' => 0,
e501603b 166 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 167 'add' => '3.4',
c3fc2621
CW
168 ],
169 'entity_id' => [
e501603b
TO
170 'name' => 'entity_id',
171 'type' => CRM_Utils_Type::T_INT,
c3fc2621 172 'title' => ts('Entity ID'),
215b423e 173 'description' => ts('FK to id of the entity that the action was performed on. Pseudo - FK.'),
c3fc2621 174 'required' => TRUE,
a36434b9 175 'where' => 'civicrm_action_log.entity_id',
522a26c9 176 'table_name' => 'civicrm_action_log',
177 'entity' => 'ActionLog',
178 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 179 'localizable' => 0,
a9d0587b 180 'add' => '3.4',
c3fc2621
CW
181 ],
182 'entity_table' => [
e501603b
TO
183 'name' => 'entity_table',
184 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 185 'title' => ts('Entity Table'),
215b423e 186 'description' => ts('name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant'),
e501603b
TO
187 'maxlength' => 255,
188 'size' => CRM_Utils_Type::HUGE,
a36434b9 189 'where' => 'civicrm_action_log.entity_table',
522a26c9 190 'table_name' => 'civicrm_action_log',
191 'entity' => 'ActionLog',
192 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 193 'localizable' => 0,
a9d0587b 194 'add' => '3.4',
c3fc2621
CW
195 ],
196 'action_schedule_id' => [
e501603b
TO
197 'name' => 'action_schedule_id',
198 'type' => CRM_Utils_Type::T_INT,
c3fc2621 199 'title' => ts('Schedule'),
215b423e 200 'description' => ts('FK to the action schedule that this action originated from.'),
c3fc2621 201 'required' => TRUE,
a36434b9 202 'where' => 'civicrm_action_log.action_schedule_id',
522a26c9 203 'table_name' => 'civicrm_action_log',
204 'entity' => 'ActionLog',
205 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 206 'localizable' => 0,
e501603b 207 'FKClassName' => 'CRM_Core_DAO_ActionSchedule',
a9d0587b 208 'add' => '3.4',
c3fc2621
CW
209 ],
210 'action_date_time' => [
e501603b
TO
211 'name' => 'action_date_time',
212 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 213 'title' => ts('Action Date And Time'),
215b423e 214 'description' => ts('date time that the action was performed on.'),
a36434b9 215 'where' => 'civicrm_action_log.action_date_time',
522a26c9 216 'table_name' => 'civicrm_action_log',
217 'entity' => 'ActionLog',
218 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 219 'localizable' => 0,
a9d0587b 220 'add' => '3.4',
c3fc2621
CW
221 ],
222 'is_error' => [
e501603b
TO
223 'name' => 'is_error',
224 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 225 'title' => ts('Error?'),
215b423e 226 'description' => ts('Was there any error sending the reminder?'),
a36434b9 227 'where' => 'civicrm_action_log.is_error',
45a83e42 228 'default' => '0',
522a26c9 229 'table_name' => 'civicrm_action_log',
230 'entity' => 'ActionLog',
231 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 232 'localizable' => 0,
a9d0587b 233 'add' => '3.4',
c3fc2621
CW
234 ],
235 'message' => [
e501603b
TO
236 'name' => 'message',
237 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 238 'title' => ts('Message'),
215b423e 239 'description' => ts('Description / text in case there was an error encountered.'),
a36434b9 240 'where' => 'civicrm_action_log.message',
522a26c9 241 'table_name' => 'civicrm_action_log',
242 'entity' => 'ActionLog',
243 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 244 'localizable' => 0,
a9d0587b 245 'add' => '3.4',
c3fc2621
CW
246 ],
247 'repetition_number' => [
e501603b
TO
248 'name' => 'repetition_number',
249 'type' => CRM_Utils_Type::T_INT,
c3fc2621 250 'title' => ts('Repetition Number'),
215b423e 251 'description' => ts('Keeps track of the sequence number of this repetition.'),
a36434b9 252 'where' => 'civicrm_action_log.repetition_number',
522a26c9 253 'table_name' => 'civicrm_action_log',
254 'entity' => 'ActionLog',
255 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 256 'localizable' => 0,
a9d0587b 257 'add' => '3.4',
c3fc2621
CW
258 ],
259 'reference_date' => [
e501603b 260 'name' => 'reference_date',
74db51d3 261 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 262 'title' => ts('Reference Date'),
215b423e 263 'description' => ts('Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)'),
a36434b9 264 'where' => 'civicrm_action_log.reference_date',
e501603b 265 'default' => 'NULL',
522a26c9 266 'table_name' => 'civicrm_action_log',
267 'entity' => 'ActionLog',
268 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 269 'localizable' => 0,
a9d0587b 270 'add' => '4.6',
c3fc2621
CW
271 ],
272 ];
346aaaba 273 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 274 }
346aaaba 275 return Civi::$statics[__CLASS__]['fields'];
e501603b 276 }
c3fc2621 277
e501603b 278 /**
bd8e0b14 279 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
280 *
281 * @return array
bd8e0b14 282 * Array(string $name => string $uniqueName).
e501603b 283 */
c3fc2621 284 public static function &fieldKeys() {
bd8e0b14
TO
285 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
286 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 287 }
bd8e0b14 288 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 289 }
c3fc2621 290
e501603b
TO
291 /**
292 * Returns the names of this table
293 *
294 * @return string
295 */
c3fc2621 296 public static function getTableName() {
e501603b
TO
297 return self::$_tableName;
298 }
c3fc2621 299
e501603b
TO
300 /**
301 * Returns if this table needs to be logged
302 *
c3fc2621 303 * @return bool
e501603b 304 */
c3fc2621 305 public function getLog() {
e501603b
TO
306 return self::$_log;
307 }
c3fc2621 308
e501603b
TO
309 /**
310 * Returns the list of fields that can be imported
311 *
312 * @param bool $prefix
313 *
314 * @return array
315 */
c3fc2621
CW
316 public static function &import($prefix = FALSE) {
317 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, []);
60808919 318 return $r;
e501603b 319 }
c3fc2621 320
e501603b
TO
321 /**
322 * Returns the list of fields that can be exported
323 *
324 * @param bool $prefix
325 *
326 * @return array
327 */
c3fc2621
CW
328 public static function &export($prefix = FALSE) {
329 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, []);
60808919 330 return $r;
e501603b 331 }
c3fc2621 332
e7a6b91a
AS
333 /**
334 * Returns the list of indices
c3fc2621
CW
335 *
336 * @param bool $localize
337 *
338 * @return array
e7a6b91a
AS
339 */
340 public static function indices($localize = TRUE) {
c3fc2621 341 $indices = [];
e7a6b91a
AS
342 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
343 }
c3fc2621 344
e501603b 345}