5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/ActionLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:f3a6da0a3e4c1c9601265c8ad6eb85f4)
13 * Database access object for the ActionLog entity.
15 class CRM_Core_DAO_ActionLog
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '3.4';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_action_log';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
34 * @var int|string|null
35 * (SQL type: int unsigned)
36 * Note that values will be retrieved from the database as a string.
43 * @var int|string|null
44 * (SQL type: int unsigned)
45 * Note that values will be retrieved from the database as a string.
50 * FK to id of the entity that the action was performed on. Pseudo - FK.
53 * (SQL type: int unsigned)
54 * Note that values will be retrieved from the database as a string.
59 * name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant
62 * (SQL type: varchar(255))
63 * Note that values will be retrieved from the database as a string.
68 * FK to the action schedule that this action originated from.
71 * (SQL type: int unsigned)
72 * Note that values will be retrieved from the database as a string.
74 public $action_schedule_id;
77 * date time that the action was performed on.
80 * (SQL type: datetime)
81 * Note that values will be retrieved from the database as a string.
83 public $action_date_time;
86 * Was there any error sending the reminder?
90 * Note that values will be retrieved from the database as a string.
95 * Description / text in case there was an error encountered.
99 * Note that values will be retrieved from the database as a string.
104 * Keeps track of the sequence number of this repetition.
106 * @var int|string|null
107 * (SQL type: int unsigned)
108 * Note that values will be retrieved from the database as a string.
110 public $repetition_number;
113 * Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)
116 * (SQL type: datetime)
117 * Note that values will be retrieved from the database as a string.
119 public $reference_date;
124 public function __construct() {
125 $this->__table
= 'civicrm_action_log';
126 parent
::__construct();
130 * Returns localized title of this entity.
132 * @param bool $plural
133 * Whether to return the plural version of the title.
135 public static function getEntityTitle($plural = FALSE) {
136 return $plural ?
ts('Action Logs') : ts('Action Log');
140 * Returns foreign keys and entity references.
143 * [CRM_Core_Reference_Interface]
145 public static function getReferenceColumns() {
146 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
147 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
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');
151 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
153 return Civi
::$statics[__CLASS__
]['links'];
157 * Returns all the column names of this table
161 public static function &fields() {
162 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
163 Civi
::$statics[__CLASS__
]['fields'] = [
166 'type' => CRM_Utils_Type
::T_INT
,
167 'title' => ts('Action Schedule ID'),
169 'where' => 'civicrm_action_log.id',
170 'table_name' => 'civicrm_action_log',
171 'entity' => 'ActionLog',
172 'bao' => 'CRM_Core_BAO_ActionLog',
181 'name' => 'contact_id',
182 'type' => CRM_Utils_Type
::T_INT
,
183 'title' => ts('Contact ID'),
184 'description' => ts('FK to Contact ID'),
185 'where' => 'civicrm_action_log.contact_id',
186 'table_name' => 'civicrm_action_log',
187 'entity' => 'ActionLog',
188 'bao' => 'CRM_Core_BAO_ActionLog',
190 'FKClassName' => 'CRM_Contact_DAO_Contact',
192 'label' => ts("Contact"),
197 'name' => 'entity_id',
198 'type' => CRM_Utils_Type
::T_INT
,
199 'title' => ts('Entity ID'),
200 'description' => ts('FK to id of the entity that the action was performed on. Pseudo - FK.'),
202 'where' => 'civicrm_action_log.entity_id',
203 'table_name' => 'civicrm_action_log',
204 'entity' => 'ActionLog',
205 'bao' => 'CRM_Core_BAO_ActionLog',
210 'name' => 'entity_table',
211 'type' => CRM_Utils_Type
::T_STRING
,
212 'title' => ts('Entity Table'),
213 'description' => ts('name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant'),
215 'size' => CRM_Utils_Type
::HUGE
,
216 'where' => 'civicrm_action_log.entity_table',
217 'table_name' => 'civicrm_action_log',
218 'entity' => 'ActionLog',
219 'bao' => 'CRM_Core_BAO_ActionLog',
223 'action_schedule_id' => [
224 'name' => 'action_schedule_id',
225 'type' => CRM_Utils_Type
::T_INT
,
226 'title' => ts('Schedule ID'),
227 'description' => ts('FK to the action schedule that this action originated from.'),
229 'where' => 'civicrm_action_log.action_schedule_id',
230 'table_name' => 'civicrm_action_log',
231 'entity' => 'ActionLog',
232 'bao' => 'CRM_Core_BAO_ActionLog',
234 'FKClassName' => 'CRM_Core_DAO_ActionSchedule',
236 'label' => ts("Schedule"),
240 'action_date_time' => [
241 'name' => 'action_date_time',
242 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
243 'title' => ts('Action Date And Time'),
244 'description' => ts('date time that the action was performed on.'),
245 'where' => 'civicrm_action_log.action_date_time',
246 'table_name' => 'civicrm_action_log',
247 'entity' => 'ActionLog',
248 'bao' => 'CRM_Core_BAO_ActionLog',
253 'name' => 'is_error',
254 'type' => CRM_Utils_Type
::T_BOOLEAN
,
255 'title' => ts('Error?'),
256 'description' => ts('Was there any error sending the reminder?'),
258 'where' => 'civicrm_action_log.is_error',
260 'table_name' => 'civicrm_action_log',
261 'entity' => 'ActionLog',
262 'bao' => 'CRM_Core_BAO_ActionLog',
268 'type' => CRM_Utils_Type
::T_TEXT
,
269 'title' => ts('Message'),
270 'description' => ts('Description / text in case there was an error encountered.'),
271 'where' => 'civicrm_action_log.message',
272 'table_name' => 'civicrm_action_log',
273 'entity' => 'ActionLog',
274 'bao' => 'CRM_Core_BAO_ActionLog',
278 'repetition_number' => [
279 'name' => 'repetition_number',
280 'type' => CRM_Utils_Type
::T_INT
,
281 'title' => ts('Repetition Number'),
282 'description' => ts('Keeps track of the sequence number of this repetition.'),
283 'where' => 'civicrm_action_log.repetition_number',
284 'table_name' => 'civicrm_action_log',
285 'entity' => 'ActionLog',
286 'bao' => 'CRM_Core_BAO_ActionLog',
290 'reference_date' => [
291 'name' => 'reference_date',
292 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
293 'title' => ts('Reference Date'),
294 'description' => ts('Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)'),
295 'where' => 'civicrm_action_log.reference_date',
297 'table_name' => 'civicrm_action_log',
298 'entity' => 'ActionLog',
299 'bao' => 'CRM_Core_BAO_ActionLog',
304 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
306 return Civi
::$statics[__CLASS__
]['fields'];
310 * Return a mapping from field-name to the corresponding key (as used in fields()).
313 * Array(string $name => string $uniqueName).
315 public static function &fieldKeys() {
316 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
317 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
319 return Civi
::$statics[__CLASS__
]['fieldKeys'];
323 * Returns the names of this table
327 public static function getTableName() {
328 return self
::$_tableName;
332 * Returns if this table needs to be logged
336 public function getLog() {
341 * Returns the list of fields that can be imported
343 * @param bool $prefix
347 public static function &import($prefix = FALSE) {
348 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'action_log', $prefix, []);
353 * Returns the list of fields that can be exported
355 * @param bool $prefix
359 public static function &export($prefix = FALSE) {
360 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'action_log', $prefix, []);
365 * Returns the list of indices
367 * @param bool $localize
371 public static function indices($localize = TRUE) {
373 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;