Merge pull request #18653 from eileenmcnaughton/token
[civicrm-core.git] / CRM / Core / DAO / ActionLog.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/ActionLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a449765feaf80c56214be9fce2f118b4)
10 */
11
12 /**
13 * Database access object for the ActionLog entity.
14 */
15 class CRM_Core_DAO_ActionLog extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.4';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_action_log';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * @var int
35 */
36 public $id;
37
38 /**
39 * FK to Contact ID
40 *
41 * @var int
42 */
43 public $contact_id;
44
45 /**
46 * FK to id of the entity that the action was performed on. Pseudo - FK.
47 *
48 * @var int
49 */
50 public $entity_id;
51
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;
58
59 /**
60 * FK to the action schedule that this action originated from.
61 *
62 * @var int
63 */
64 public $action_schedule_id;
65
66 /**
67 * date time that the action was performed on.
68 *
69 * @var datetime
70 */
71 public $action_date_time;
72
73 /**
74 * Was there any error sending the reminder?
75 *
76 * @var bool
77 */
78 public $is_error;
79
80 /**
81 * Description / text in case there was an error encountered.
82 *
83 * @var text
84 */
85 public $message;
86
87 /**
88 * Keeps track of the sequence number of this repetition.
89 *
90 * @var int
91 */
92 public $repetition_number;
93
94 /**
95 * Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)
96 *
97 * @var datetime
98 */
99 public $reference_date;
100
101 /**
102 * Class constructor.
103 */
104 public function __construct() {
105 $this->__table = 'civicrm_action_log';
106 parent::__construct();
107 }
108
109 /**
110 * Returns localized title of this entity.
111 *
112 * @param bool $plural
113 * Whether to return the plural version of the title.
114 */
115 public static function getEntityTitle($plural = FALSE) {
116 return $plural ? ts('Action Logs') : ts('Action Log');
117 }
118
119 /**
120 * Returns foreign keys and entity references.
121 *
122 * @return array
123 * [CRM_Core_Reference_Interface]
124 */
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']);
132 }
133 return Civi::$statics[__CLASS__]['links'];
134 }
135
136 /**
137 * Returns all the column names of this table
138 *
139 * @return array
140 */
141 public static function &fields() {
142 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
143 Civi::$statics[__CLASS__]['fields'] = [
144 'id' => [
145 'name' => 'id',
146 'type' => CRM_Utils_Type::T_INT,
147 'title' => ts('Action Schedule ID'),
148 'required' => TRUE,
149 'where' => 'civicrm_action_log.id',
150 'table_name' => 'civicrm_action_log',
151 'entity' => 'ActionLog',
152 'bao' => 'CRM_Core_BAO_ActionLog',
153 'localizable' => 0,
154 'add' => '3.4',
155 ],
156 'contact_id' => [
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',
165 'localizable' => 0,
166 'FKClassName' => 'CRM_Contact_DAO_Contact',
167 'add' => '3.4',
168 ],
169 'entity_id' => [
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.'),
174 'required' => TRUE,
175 'where' => 'civicrm_action_log.entity_id',
176 'table_name' => 'civicrm_action_log',
177 'entity' => 'ActionLog',
178 'bao' => 'CRM_Core_BAO_ActionLog',
179 'localizable' => 0,
180 'add' => '3.4',
181 ],
182 'entity_table' => [
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'),
187 'maxlength' => 255,
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',
193 'localizable' => 0,
194 'add' => '3.4',
195 ],
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.'),
201 'required' => TRUE,
202 'where' => 'civicrm_action_log.action_schedule_id',
203 'table_name' => 'civicrm_action_log',
204 'entity' => 'ActionLog',
205 'bao' => 'CRM_Core_BAO_ActionLog',
206 'localizable' => 0,
207 'FKClassName' => 'CRM_Core_DAO_ActionSchedule',
208 'add' => '3.4',
209 ],
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',
219 'localizable' => 0,
220 'add' => '3.4',
221 ],
222 'is_error' => [
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',
228 'default' => '0',
229 'table_name' => 'civicrm_action_log',
230 'entity' => 'ActionLog',
231 'bao' => 'CRM_Core_BAO_ActionLog',
232 'localizable' => 0,
233 'add' => '3.4',
234 ],
235 'message' => [
236 'name' => 'message',
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',
244 'localizable' => 0,
245 'add' => '3.4',
246 ],
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',
256 'localizable' => 0,
257 'add' => '3.4',
258 ],
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',
265 'default' => 'NULL',
266 'table_name' => 'civicrm_action_log',
267 'entity' => 'ActionLog',
268 'bao' => 'CRM_Core_BAO_ActionLog',
269 'localizable' => 0,
270 'add' => '4.6',
271 ],
272 ];
273 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
274 }
275 return Civi::$statics[__CLASS__]['fields'];
276 }
277
278 /**
279 * Return a mapping from field-name to the corresponding key (as used in fields()).
280 *
281 * @return array
282 * Array(string $name => string $uniqueName).
283 */
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()));
287 }
288 return Civi::$statics[__CLASS__]['fieldKeys'];
289 }
290
291 /**
292 * Returns the names of this table
293 *
294 * @return string
295 */
296 public static function getTableName() {
297 return self::$_tableName;
298 }
299
300 /**
301 * Returns if this table needs to be logged
302 *
303 * @return bool
304 */
305 public function getLog() {
306 return self::$_log;
307 }
308
309 /**
310 * Returns the list of fields that can be imported
311 *
312 * @param bool $prefix
313 *
314 * @return array
315 */
316 public static function &import($prefix = FALSE) {
317 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, []);
318 return $r;
319 }
320
321 /**
322 * Returns the list of fields that can be exported
323 *
324 * @param bool $prefix
325 *
326 * @return array
327 */
328 public static function &export($prefix = FALSE) {
329 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, []);
330 return $r;
331 }
332
333 /**
334 * Returns the list of indices
335 *
336 * @param bool $localize
337 *
338 * @return array
339 */
340 public static function indices($localize = TRUE) {
341 $indices = [];
342 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
343 }
344
345 }