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