Merge pull request #21517 from mattwire/propertybagrecurinstallments
[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:b2a5ecdfd400bdf2fe892f9391f8a7ea)
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 'html' => [
155 'type' => 'Number',
156 ],
157 'readonly' => TRUE,
158 'add' => '3.4',
159 ],
160 'contact_id' => [
161 'name' => 'contact_id',
162 'type' => CRM_Utils_Type::T_INT,
163 'title' => ts('Contact ID'),
164 'description' => ts('FK to Contact ID'),
165 'where' => 'civicrm_action_log.contact_id',
166 'table_name' => 'civicrm_action_log',
167 'entity' => 'ActionLog',
168 'bao' => 'CRM_Core_BAO_ActionLog',
169 'localizable' => 0,
170 'FKClassName' => 'CRM_Contact_DAO_Contact',
171 'html' => [
172 'label' => ts("Contact"),
173 ],
174 'add' => '3.4',
175 ],
176 'entity_id' => [
177 'name' => 'entity_id',
178 'type' => CRM_Utils_Type::T_INT,
179 'title' => ts('Entity ID'),
180 'description' => ts('FK to id of the entity that the action was performed on. Pseudo - FK.'),
181 'required' => TRUE,
182 'where' => 'civicrm_action_log.entity_id',
183 'table_name' => 'civicrm_action_log',
184 'entity' => 'ActionLog',
185 'bao' => 'CRM_Core_BAO_ActionLog',
186 'localizable' => 0,
187 'add' => '3.4',
188 ],
189 'entity_table' => [
190 'name' => 'entity_table',
191 'type' => CRM_Utils_Type::T_STRING,
192 'title' => ts('Entity Table'),
193 'description' => ts('name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant'),
194 'maxlength' => 255,
195 'size' => CRM_Utils_Type::HUGE,
196 'where' => 'civicrm_action_log.entity_table',
197 'table_name' => 'civicrm_action_log',
198 'entity' => 'ActionLog',
199 'bao' => 'CRM_Core_BAO_ActionLog',
200 'localizable' => 0,
201 'add' => '3.4',
202 ],
203 'action_schedule_id' => [
204 'name' => 'action_schedule_id',
205 'type' => CRM_Utils_Type::T_INT,
206 'title' => ts('Schedule ID'),
207 'description' => ts('FK to the action schedule that this action originated from.'),
208 'required' => TRUE,
209 'where' => 'civicrm_action_log.action_schedule_id',
210 'table_name' => 'civicrm_action_log',
211 'entity' => 'ActionLog',
212 'bao' => 'CRM_Core_BAO_ActionLog',
213 'localizable' => 0,
214 'FKClassName' => 'CRM_Core_DAO_ActionSchedule',
215 'html' => [
216 'label' => ts("Schedule"),
217 ],
218 'add' => '3.4',
219 ],
220 'action_date_time' => [
221 'name' => 'action_date_time',
222 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
223 'title' => ts('Action Date And Time'),
224 'description' => ts('date time that the action was performed on.'),
225 'where' => 'civicrm_action_log.action_date_time',
226 'table_name' => 'civicrm_action_log',
227 'entity' => 'ActionLog',
228 'bao' => 'CRM_Core_BAO_ActionLog',
229 'localizable' => 0,
230 'add' => '3.4',
231 ],
232 'is_error' => [
233 'name' => 'is_error',
234 'type' => CRM_Utils_Type::T_BOOLEAN,
235 'title' => ts('Error?'),
236 'description' => ts('Was there any error sending the reminder?'),
237 'where' => 'civicrm_action_log.is_error',
238 'default' => '0',
239 'table_name' => 'civicrm_action_log',
240 'entity' => 'ActionLog',
241 'bao' => 'CRM_Core_BAO_ActionLog',
242 'localizable' => 0,
243 'add' => '3.4',
244 ],
245 'message' => [
246 'name' => 'message',
247 'type' => CRM_Utils_Type::T_TEXT,
248 'title' => ts('Message'),
249 'description' => ts('Description / text in case there was an error encountered.'),
250 'where' => 'civicrm_action_log.message',
251 'table_name' => 'civicrm_action_log',
252 'entity' => 'ActionLog',
253 'bao' => 'CRM_Core_BAO_ActionLog',
254 'localizable' => 0,
255 'add' => '3.4',
256 ],
257 'repetition_number' => [
258 'name' => 'repetition_number',
259 'type' => CRM_Utils_Type::T_INT,
260 'title' => ts('Repetition Number'),
261 'description' => ts('Keeps track of the sequence number of this repetition.'),
262 'where' => 'civicrm_action_log.repetition_number',
263 'table_name' => 'civicrm_action_log',
264 'entity' => 'ActionLog',
265 'bao' => 'CRM_Core_BAO_ActionLog',
266 'localizable' => 0,
267 'add' => '3.4',
268 ],
269 'reference_date' => [
270 'name' => 'reference_date',
271 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
272 'title' => ts('Reference Date'),
273 'description' => ts('Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)'),
274 'where' => 'civicrm_action_log.reference_date',
275 'default' => NULL,
276 'table_name' => 'civicrm_action_log',
277 'entity' => 'ActionLog',
278 'bao' => 'CRM_Core_BAO_ActionLog',
279 'localizable' => 0,
280 'add' => '4.6',
281 ],
282 ];
283 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
284 }
285 return Civi::$statics[__CLASS__]['fields'];
286 }
287
288 /**
289 * Return a mapping from field-name to the corresponding key (as used in fields()).
290 *
291 * @return array
292 * Array(string $name => string $uniqueName).
293 */
294 public static function &fieldKeys() {
295 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
296 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
297 }
298 return Civi::$statics[__CLASS__]['fieldKeys'];
299 }
300
301 /**
302 * Returns the names of this table
303 *
304 * @return string
305 */
306 public static function getTableName() {
307 return self::$_tableName;
308 }
309
310 /**
311 * Returns if this table needs to be logged
312 *
313 * @return bool
314 */
315 public function getLog() {
316 return self::$_log;
317 }
318
319 /**
320 * Returns the list of fields that can be imported
321 *
322 * @param bool $prefix
323 *
324 * @return array
325 */
326 public static function &import($prefix = FALSE) {
327 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, []);
328 return $r;
329 }
330
331 /**
332 * Returns the list of fields that can be exported
333 *
334 * @param bool $prefix
335 *
336 * @return array
337 */
338 public static function &export($prefix = FALSE) {
339 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, []);
340 return $r;
341 }
342
343 /**
344 * Returns the list of indices
345 *
346 * @param bool $localize
347 *
348 * @return array
349 */
350 public static function indices($localize = TRUE) {
351 $indices = [];
352 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
353 }
354
355 }