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:a449765feaf80c56214be9fce2f118b4)
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;
46 * FK to id of the entity that the action was performed on. Pseudo - FK.
53 * name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant
60 * FK to the action schedule that this action originated from.
64 public $action_schedule_id;
67 * date time that the action was performed on.
71 public $action_date_time;
74 * Was there any error sending the reminder?
81 * Description / text in case there was an error encountered.
88 * Keeps track of the sequence number of this repetition.
92 public $repetition_number;
95 * Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)
99 public $reference_date;
104 public function __construct() {
105 $this->__table
= 'civicrm_action_log';
106 parent
::__construct();
110 * Returns localized title of this entity.
112 * @param bool $plural
113 * Whether to return the plural version of the title.
115 public static function getEntityTitle($plural = FALSE) {
116 return $plural ?
ts('Action Logs') : ts('Action Log');
120 * Returns foreign keys and entity references.
123 * [CRM_Core_Reference_Interface]
125 public static function getReferenceColumns() {
126 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
127 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
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');
131 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
133 return Civi
::$statics[__CLASS__
]['links'];
137 * Returns all the column names of this table
141 public static function &fields() {
142 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
143 Civi
::$statics[__CLASS__
]['fields'] = [
146 'type' => CRM_Utils_Type
::T_INT
,
147 'title' => ts('Action Schedule ID'),
149 'where' => 'civicrm_action_log.id',
150 'table_name' => 'civicrm_action_log',
151 'entity' => 'ActionLog',
152 'bao' => 'CRM_Core_BAO_ActionLog',
157 'name' => 'contact_id',
158 'type' => CRM_Utils_Type
::T_INT
,
159 'title' => ts('Action Schedule Contact ID'),
160 'description' => ts('FK to Contact ID'),
161 'where' => 'civicrm_action_log.contact_id',
162 'table_name' => 'civicrm_action_log',
163 'entity' => 'ActionLog',
164 'bao' => 'CRM_Core_BAO_ActionLog',
166 'FKClassName' => 'CRM_Contact_DAO_Contact',
170 'name' => 'entity_id',
171 'type' => CRM_Utils_Type
::T_INT
,
172 'title' => ts('Entity ID'),
173 'description' => ts('FK to id of the entity that the action was performed on. Pseudo - FK.'),
175 'where' => 'civicrm_action_log.entity_id',
176 'table_name' => 'civicrm_action_log',
177 'entity' => 'ActionLog',
178 'bao' => 'CRM_Core_BAO_ActionLog',
183 'name' => 'entity_table',
184 'type' => CRM_Utils_Type
::T_STRING
,
185 'title' => ts('Entity Table'),
186 'description' => ts('name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant'),
188 'size' => CRM_Utils_Type
::HUGE
,
189 'where' => 'civicrm_action_log.entity_table',
190 'table_name' => 'civicrm_action_log',
191 'entity' => 'ActionLog',
192 'bao' => 'CRM_Core_BAO_ActionLog',
196 'action_schedule_id' => [
197 'name' => 'action_schedule_id',
198 'type' => CRM_Utils_Type
::T_INT
,
199 'title' => ts('Schedule'),
200 'description' => ts('FK to the action schedule that this action originated from.'),
202 'where' => 'civicrm_action_log.action_schedule_id',
203 'table_name' => 'civicrm_action_log',
204 'entity' => 'ActionLog',
205 'bao' => 'CRM_Core_BAO_ActionLog',
207 'FKClassName' => 'CRM_Core_DAO_ActionSchedule',
210 'action_date_time' => [
211 'name' => 'action_date_time',
212 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
213 'title' => ts('Action Date And Time'),
214 'description' => ts('date time that the action was performed on.'),
215 'where' => 'civicrm_action_log.action_date_time',
216 'table_name' => 'civicrm_action_log',
217 'entity' => 'ActionLog',
218 'bao' => 'CRM_Core_BAO_ActionLog',
223 'name' => 'is_error',
224 'type' => CRM_Utils_Type
::T_BOOLEAN
,
225 'title' => ts('Error?'),
226 'description' => ts('Was there any error sending the reminder?'),
227 'where' => 'civicrm_action_log.is_error',
229 'table_name' => 'civicrm_action_log',
230 'entity' => 'ActionLog',
231 'bao' => 'CRM_Core_BAO_ActionLog',
237 'type' => CRM_Utils_Type
::T_TEXT
,
238 'title' => ts('Message'),
239 'description' => ts('Description / text in case there was an error encountered.'),
240 'where' => 'civicrm_action_log.message',
241 'table_name' => 'civicrm_action_log',
242 'entity' => 'ActionLog',
243 'bao' => 'CRM_Core_BAO_ActionLog',
247 'repetition_number' => [
248 'name' => 'repetition_number',
249 'type' => CRM_Utils_Type
::T_INT
,
250 'title' => ts('Repetition Number'),
251 'description' => ts('Keeps track of the sequence number of this repetition.'),
252 'where' => 'civicrm_action_log.repetition_number',
253 'table_name' => 'civicrm_action_log',
254 'entity' => 'ActionLog',
255 'bao' => 'CRM_Core_BAO_ActionLog',
259 'reference_date' => [
260 'name' => 'reference_date',
261 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
262 'title' => ts('Reference Date'),
263 'description' => ts('Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)'),
264 'where' => 'civicrm_action_log.reference_date',
266 'table_name' => 'civicrm_action_log',
267 'entity' => 'ActionLog',
268 'bao' => 'CRM_Core_BAO_ActionLog',
273 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
275 return Civi
::$statics[__CLASS__
]['fields'];
279 * Return a mapping from field-name to the corresponding key (as used in fields()).
282 * Array(string $name => string $uniqueName).
284 public static function &fieldKeys() {
285 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
286 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
288 return Civi
::$statics[__CLASS__
]['fieldKeys'];
292 * Returns the names of this table
296 public static function getTableName() {
297 return self
::$_tableName;
301 * Returns if this table needs to be logged
305 public function getLog() {
310 * Returns the list of fields that can be imported
312 * @param bool $prefix
316 public static function &import($prefix = FALSE) {
317 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'action_log', $prefix, []);
322 * Returns the list of fields that can be exported
324 * @param bool $prefix
328 public static function &export($prefix = FALSE) {
329 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'action_log', $prefix, []);
334 * Returns the list of indices
336 * @param bool $localize
340 public static function indices($localize = TRUE) {
342 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;