Merge pull request #10403 from yashodha/CRM-20624
[civicrm-core.git] / CRM / Core / DAO / ActionLog.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Core/ActionLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4ef96df03630ecc884c881b79a40818f)
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 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 static $_log = FALSE;
30
31 /**
32 * @var int unsigned
33 */
34 public $id;
35
36 /**
37 * FK to Contact ID
38 *
39 * @var int unsigned
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 unsigned
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 unsigned
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 boolean
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 unsigned
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 'table_name' => 'civicrm_action_log',
138 'entity' => 'ActionLog',
139 'bao' => 'CRM_Core_BAO_ActionLog',
140 'localizable' => 0,
141 ],
142 'contact_id' => [
143 'name' => 'contact_id',
144 'type' => CRM_Utils_Type::T_INT,
145 'title' => ts('Action Schedule Contact ID'),
146 'description' => 'FK to Contact ID',
147 'table_name' => 'civicrm_action_log',
148 'entity' => 'ActionLog',
149 'bao' => 'CRM_Core_BAO_ActionLog',
150 'localizable' => 0,
151 'FKClassName' => 'CRM_Contact_DAO_Contact',
152 ],
153 'entity_id' => [
154 'name' => 'entity_id',
155 'type' => CRM_Utils_Type::T_INT,
156 'title' => ts('Entity ID'),
157 'description' => 'FK to id of the entity that the action was performed on. Pseudo - FK.',
158 'required' => TRUE,
159 'table_name' => 'civicrm_action_log',
160 'entity' => 'ActionLog',
161 'bao' => 'CRM_Core_BAO_ActionLog',
162 'localizable' => 0,
163 ],
164 'entity_table' => [
165 'name' => 'entity_table',
166 'type' => CRM_Utils_Type::T_STRING,
167 'title' => ts('Entity Table'),
168 'description' => 'name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant',
169 'maxlength' => 255,
170 'size' => CRM_Utils_Type::HUGE,
171 'table_name' => 'civicrm_action_log',
172 'entity' => 'ActionLog',
173 'bao' => 'CRM_Core_BAO_ActionLog',
174 'localizable' => 0,
175 ],
176 'action_schedule_id' => [
177 'name' => 'action_schedule_id',
178 'type' => CRM_Utils_Type::T_INT,
179 'title' => ts('Schedule'),
180 'description' => 'FK to the action schedule that this action originated from.',
181 'required' => TRUE,
182 'table_name' => 'civicrm_action_log',
183 'entity' => 'ActionLog',
184 'bao' => 'CRM_Core_BAO_ActionLog',
185 'localizable' => 0,
186 'FKClassName' => 'CRM_Core_DAO_ActionSchedule',
187 ],
188 'action_date_time' => [
189 'name' => 'action_date_time',
190 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
191 'title' => ts('Action Date And Time'),
192 'description' => 'date time that the action was performed on.',
193 'table_name' => 'civicrm_action_log',
194 'entity' => 'ActionLog',
195 'bao' => 'CRM_Core_BAO_ActionLog',
196 'localizable' => 0,
197 ],
198 'is_error' => [
199 'name' => 'is_error',
200 'type' => CRM_Utils_Type::T_BOOLEAN,
201 'title' => ts('Error?'),
202 'description' => 'Was there any error sending the reminder?',
203 'table_name' => 'civicrm_action_log',
204 'entity' => 'ActionLog',
205 'bao' => 'CRM_Core_BAO_ActionLog',
206 'localizable' => 0,
207 ],
208 'message' => [
209 'name' => 'message',
210 'type' => CRM_Utils_Type::T_TEXT,
211 'title' => ts('Message'),
212 'description' => 'Description / text in case there was an error encountered.',
213 'table_name' => 'civicrm_action_log',
214 'entity' => 'ActionLog',
215 'bao' => 'CRM_Core_BAO_ActionLog',
216 'localizable' => 0,
217 ],
218 'repetition_number' => [
219 'name' => 'repetition_number',
220 'type' => CRM_Utils_Type::T_INT,
221 'title' => ts('Repetition Number'),
222 'description' => 'Keeps track of the sequence number of this repetition.',
223 'table_name' => 'civicrm_action_log',
224 'entity' => 'ActionLog',
225 'bao' => 'CRM_Core_BAO_ActionLog',
226 'localizable' => 0,
227 ],
228 'reference_date' => [
229 'name' => 'reference_date',
230 'type' => CRM_Utils_Type::T_DATE,
231 'title' => ts('Reference Date'),
232 'description' => 'Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)',
233 'default' => 'NULL',
234 'table_name' => 'civicrm_action_log',
235 'entity' => 'ActionLog',
236 'bao' => 'CRM_Core_BAO_ActionLog',
237 'localizable' => 0,
238 ],
239 ];
240 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
241 }
242 return Civi::$statics[__CLASS__]['fields'];
243 }
244
245 /**
246 * Return a mapping from field-name to the corresponding key (as used in fields()).
247 *
248 * @return array
249 * Array(string $name => string $uniqueName).
250 */
251 public static function &fieldKeys() {
252 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
253 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
254 }
255 return Civi::$statics[__CLASS__]['fieldKeys'];
256 }
257
258 /**
259 * Returns the names of this table
260 *
261 * @return string
262 */
263 public static function getTableName() {
264 return self::$_tableName;
265 }
266
267 /**
268 * Returns if this table needs to be logged
269 *
270 * @return bool
271 */
272 public function getLog() {
273 return self::$_log;
274 }
275
276 /**
277 * Returns the list of fields that can be imported
278 *
279 * @param bool $prefix
280 *
281 * @return array
282 */
283 public static function &import($prefix = FALSE) {
284 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, []);
285 return $r;
286 }
287
288 /**
289 * Returns the list of fields that can be exported
290 *
291 * @param bool $prefix
292 *
293 * @return array
294 */
295 public static function &export($prefix = FALSE) {
296 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, []);
297 return $r;
298 }
299
300 /**
301 * Returns the list of indices
302 *
303 * @param bool $localize
304 *
305 * @return array
306 */
307 public static function indices($localize = TRUE) {
308 $indices = [];
309 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
310 }
311
312 }