Regenerate DAO files
[civicrm-core.git] / CRM / Core / DAO / ActionLog.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/ActionLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:2ccacada384ba37fcf929647dfa3d845)
10 */
11
12 /**
13 * Database access object for the ActionLog entity.
14 */
15 class CRM_Core_DAO_ActionLog extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_action_log';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = FALSE;
30
31 /**
32 * @var int
33 */
34 public $id;
35
36 /**
37 * FK to Contact ID
38 *
39 * @var int
40 */
41 public $contact_id;
42
43 /**
44 * FK to id of the entity that the action was performed on. Pseudo - FK.
45 *
46 * @var int
47 */
48 public $entity_id;
49
50 /**
51 * name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant
52 *
53 * @var string
54 */
55 public $entity_table;
56
57 /**
58 * FK to the action schedule that this action originated from.
59 *
60 * @var int
61 */
62 public $action_schedule_id;
63
64 /**
65 * date time that the action was performed on.
66 *
67 * @var datetime
68 */
69 public $action_date_time;
70
71 /**
72 * Was there any error sending the reminder?
73 *
74 * @var bool
75 */
76 public $is_error;
77
78 /**
79 * Description / text in case there was an error encountered.
80 *
81 * @var text
82 */
83 public $message;
84
85 /**
86 * Keeps track of the sequence number of this repetition.
87 *
88 * @var int
89 */
90 public $repetition_number;
91
92 /**
93 * Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)
94 *
95 * @var date
96 */
97 public $reference_date;
98
99 /**
100 * Class constructor.
101 */
102 public function __construct() {
103 $this->__table = 'civicrm_action_log';
104 parent::__construct();
105 }
106
107 /**
108 * Returns foreign keys and entity references.
109 *
110 * @return array
111 * [CRM_Core_Reference_Interface]
112 */
113 public static function getReferenceColumns() {
114 if (!isset(Civi::$statics[__CLASS__]['links'])) {
115 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
116 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
117 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'action_schedule_id', 'civicrm_action_schedule', 'id');
118 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
119 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
120 }
121 return Civi::$statics[__CLASS__]['links'];
122 }
123
124 /**
125 * Returns all the column names of this table
126 *
127 * @return array
128 */
129 public static function &fields() {
130 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
131 Civi::$statics[__CLASS__]['fields'] = [
132 'id' => [
133 'name' => 'id',
134 'type' => CRM_Utils_Type::T_INT,
135 'title' => ts('Action Schedule ID'),
136 'required' => TRUE,
137 'where' => 'civicrm_action_log.id',
138 'table_name' => 'civicrm_action_log',
139 'entity' => 'ActionLog',
140 'bao' => 'CRM_Core_BAO_ActionLog',
141 'localizable' => 0,
142 ],
143 'contact_id' => [
144 'name' => 'contact_id',
145 'type' => CRM_Utils_Type::T_INT,
146 'title' => ts('Action Schedule Contact ID'),
147 'description' => ts('FK to Contact ID'),
148 'where' => 'civicrm_action_log.contact_id',
149 'table_name' => 'civicrm_action_log',
150 'entity' => 'ActionLog',
151 'bao' => 'CRM_Core_BAO_ActionLog',
152 'localizable' => 0,
153 'FKClassName' => 'CRM_Contact_DAO_Contact',
154 ],
155 'entity_id' => [
156 'name' => 'entity_id',
157 'type' => CRM_Utils_Type::T_INT,
158 'title' => ts('Entity ID'),
159 'description' => ts('FK to id of the entity that the action was performed on. Pseudo - FK.'),
160 'required' => TRUE,
161 'where' => 'civicrm_action_log.entity_id',
162 'table_name' => 'civicrm_action_log',
163 'entity' => 'ActionLog',
164 'bao' => 'CRM_Core_BAO_ActionLog',
165 'localizable' => 0,
166 ],
167 'entity_table' => [
168 'name' => 'entity_table',
169 'type' => CRM_Utils_Type::T_STRING,
170 'title' => ts('Entity Table'),
171 'description' => ts('name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant'),
172 'maxlength' => 255,
173 'size' => CRM_Utils_Type::HUGE,
174 'where' => 'civicrm_action_log.entity_table',
175 'table_name' => 'civicrm_action_log',
176 'entity' => 'ActionLog',
177 'bao' => 'CRM_Core_BAO_ActionLog',
178 'localizable' => 0,
179 ],
180 'action_schedule_id' => [
181 'name' => 'action_schedule_id',
182 'type' => CRM_Utils_Type::T_INT,
183 'title' => ts('Schedule'),
184 'description' => ts('FK to the action schedule that this action originated from.'),
185 'required' => TRUE,
186 'where' => 'civicrm_action_log.action_schedule_id',
187 'table_name' => 'civicrm_action_log',
188 'entity' => 'ActionLog',
189 'bao' => 'CRM_Core_BAO_ActionLog',
190 'localizable' => 0,
191 'FKClassName' => 'CRM_Core_DAO_ActionSchedule',
192 ],
193 'action_date_time' => [
194 'name' => 'action_date_time',
195 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
196 'title' => ts('Action Date And Time'),
197 'description' => ts('date time that the action was performed on.'),
198 'where' => 'civicrm_action_log.action_date_time',
199 'table_name' => 'civicrm_action_log',
200 'entity' => 'ActionLog',
201 'bao' => 'CRM_Core_BAO_ActionLog',
202 'localizable' => 0,
203 ],
204 'is_error' => [
205 'name' => 'is_error',
206 'type' => CRM_Utils_Type::T_BOOLEAN,
207 'title' => ts('Error?'),
208 'description' => ts('Was there any error sending the reminder?'),
209 'where' => 'civicrm_action_log.is_error',
210 'default' => '0',
211 'table_name' => 'civicrm_action_log',
212 'entity' => 'ActionLog',
213 'bao' => 'CRM_Core_BAO_ActionLog',
214 'localizable' => 0,
215 ],
216 'message' => [
217 'name' => 'message',
218 'type' => CRM_Utils_Type::T_TEXT,
219 'title' => ts('Message'),
220 'description' => ts('Description / text in case there was an error encountered.'),
221 'where' => 'civicrm_action_log.message',
222 'table_name' => 'civicrm_action_log',
223 'entity' => 'ActionLog',
224 'bao' => 'CRM_Core_BAO_ActionLog',
225 'localizable' => 0,
226 ],
227 'repetition_number' => [
228 'name' => 'repetition_number',
229 'type' => CRM_Utils_Type::T_INT,
230 'title' => ts('Repetition Number'),
231 'description' => ts('Keeps track of the sequence number of this repetition.'),
232 'where' => 'civicrm_action_log.repetition_number',
233 'table_name' => 'civicrm_action_log',
234 'entity' => 'ActionLog',
235 'bao' => 'CRM_Core_BAO_ActionLog',
236 'localizable' => 0,
237 ],
238 'reference_date' => [
239 'name' => 'reference_date',
240 'type' => CRM_Utils_Type::T_DATE,
241 'title' => ts('Reference Date'),
242 'description' => ts('Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)'),
243 'where' => 'civicrm_action_log.reference_date',
244 'default' => 'NULL',
245 'table_name' => 'civicrm_action_log',
246 'entity' => 'ActionLog',
247 'bao' => 'CRM_Core_BAO_ActionLog',
248 'localizable' => 0,
249 ],
250 ];
251 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
252 }
253 return Civi::$statics[__CLASS__]['fields'];
254 }
255
256 /**
257 * Return a mapping from field-name to the corresponding key (as used in fields()).
258 *
259 * @return array
260 * Array(string $name => string $uniqueName).
261 */
262 public static function &fieldKeys() {
263 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
264 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
265 }
266 return Civi::$statics[__CLASS__]['fieldKeys'];
267 }
268
269 /**
270 * Returns the names of this table
271 *
272 * @return string
273 */
274 public static function getTableName() {
275 return self::$_tableName;
276 }
277
278 /**
279 * Returns if this table needs to be logged
280 *
281 * @return bool
282 */
283 public function getLog() {
284 return self::$_log;
285 }
286
287 /**
288 * Returns the list of fields that can be imported
289 *
290 * @param bool $prefix
291 *
292 * @return array
293 */
294 public static function &import($prefix = FALSE) {
295 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, []);
296 return $r;
297 }
298
299 /**
300 * Returns the list of fields that can be exported
301 *
302 * @param bool $prefix
303 *
304 * @return array
305 */
306 public static function &export($prefix = FALSE) {
307 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, []);
308 return $r;
309 }
310
311 /**
312 * Returns the list of indices
313 *
314 * @param bool $localize
315 *
316 * @return array
317 */
318 public static function indices($localize = TRUE) {
319 $indices = [];
320 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
321 }
322
323 }