Merge pull request #22631 from braders/calculateBaseScheduleDate-docblock
[civicrm-core.git] / CRM / Core / DAO / SystemLog.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/SystemLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0859d091be6dca4edd108b6a1803ef35)
10 */
11
12 /**
13 * Database access object for the SystemLog entity.
14 */
15 class CRM_Core_DAO_SystemLog extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '4.5';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_system_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 * Primary key ID
35 *
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
39 */
40 public $id;
41
42 /**
43 * Standardized message
44 *
45 * @var string
46 * (SQL type: varchar(128))
47 * Note that values will be retrieved from the database as a string.
48 */
49 public $message;
50
51 /**
52 * JSON encoded data
53 *
54 * @var string|null
55 * (SQL type: longtext)
56 * Note that values will be retrieved from the database as a string.
57 */
58 public $context;
59
60 /**
61 * error level per PSR3
62 *
63 * @var string|null
64 * (SQL type: varchar(9))
65 * Note that values will be retrieved from the database as a string.
66 */
67 public $level;
68
69 /**
70 * Timestamp of when event occurred.
71 *
72 * @var string|null
73 * (SQL type: timestamp)
74 * Note that values will be retrieved from the database as a string.
75 */
76 public $timestamp;
77
78 /**
79 * Optional Contact ID that created the log. Not an FK as we keep this regardless
80 *
81 * @var int|string|null
82 * (SQL type: int unsigned)
83 * Note that values will be retrieved from the database as a string.
84 */
85 public $contact_id;
86
87 /**
88 * Optional Name of logging host
89 *
90 * @var string|null
91 * (SQL type: varchar(128))
92 * Note that values will be retrieved from the database as a string.
93 */
94 public $hostname;
95
96 /**
97 * Class constructor.
98 */
99 public function __construct() {
100 $this->__table = 'civicrm_system_log';
101 parent::__construct();
102 }
103
104 /**
105 * Returns localized title of this entity.
106 *
107 * @param bool $plural
108 * Whether to return the plural version of the title.
109 */
110 public static function getEntityTitle($plural = FALSE) {
111 return $plural ? ts('System Logs') : ts('System Log');
112 }
113
114 /**
115 * Returns all the column names of this table
116 *
117 * @return array
118 */
119 public static function &fields() {
120 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
121 Civi::$statics[__CLASS__]['fields'] = [
122 'id' => [
123 'name' => 'id',
124 'type' => CRM_Utils_Type::T_INT,
125 'title' => ts('System Log ID'),
126 'description' => ts('Primary key ID'),
127 'required' => TRUE,
128 'where' => 'civicrm_system_log.id',
129 'table_name' => 'civicrm_system_log',
130 'entity' => 'SystemLog',
131 'bao' => 'CRM_Core_DAO_SystemLog',
132 'localizable' => 0,
133 'html' => [
134 'type' => 'Number',
135 ],
136 'readonly' => TRUE,
137 'add' => '4.4',
138 ],
139 'message' => [
140 'name' => 'message',
141 'type' => CRM_Utils_Type::T_STRING,
142 'title' => ts('System Log Message'),
143 'description' => ts('Standardized message'),
144 'required' => TRUE,
145 'maxlength' => 128,
146 'size' => CRM_Utils_Type::HUGE,
147 'where' => 'civicrm_system_log.message',
148 'table_name' => 'civicrm_system_log',
149 'entity' => 'SystemLog',
150 'bao' => 'CRM_Core_DAO_SystemLog',
151 'localizable' => 0,
152 'add' => '4.5',
153 ],
154 'context' => [
155 'name' => 'context',
156 'type' => CRM_Utils_Type::T_LONGTEXT,
157 'title' => ts('Detailed Log Data'),
158 'description' => ts('JSON encoded data'),
159 'where' => 'civicrm_system_log.context',
160 'table_name' => 'civicrm_system_log',
161 'entity' => 'SystemLog',
162 'bao' => 'CRM_Core_DAO_SystemLog',
163 'localizable' => 0,
164 'add' => '4.5',
165 ],
166 'level' => [
167 'name' => 'level',
168 'type' => CRM_Utils_Type::T_STRING,
169 'title' => ts('Detailed Log Data'),
170 'description' => ts('error level per PSR3'),
171 'maxlength' => 9,
172 'size' => CRM_Utils_Type::TWELVE,
173 'where' => 'civicrm_system_log.level',
174 'default' => 'info',
175 'table_name' => 'civicrm_system_log',
176 'entity' => 'SystemLog',
177 'bao' => 'CRM_Core_DAO_SystemLog',
178 'localizable' => 0,
179 'add' => '4.5',
180 ],
181 'timestamp' => [
182 'name' => 'timestamp',
183 'type' => CRM_Utils_Type::T_TIMESTAMP,
184 'title' => ts('Log Timestamp'),
185 'description' => ts('Timestamp of when event occurred.'),
186 'where' => 'civicrm_system_log.timestamp',
187 'default' => 'CURRENT_TIMESTAMP',
188 'table_name' => 'civicrm_system_log',
189 'entity' => 'SystemLog',
190 'bao' => 'CRM_Core_DAO_SystemLog',
191 'localizable' => 0,
192 'add' => '4.5',
193 ],
194 'contact_id' => [
195 'name' => 'contact_id',
196 'type' => CRM_Utils_Type::T_INT,
197 'title' => ts('Log Contact ID'),
198 'description' => ts('Optional Contact ID that created the log. Not an FK as we keep this regardless'),
199 'where' => 'civicrm_system_log.contact_id',
200 'table_name' => 'civicrm_system_log',
201 'entity' => 'SystemLog',
202 'bao' => 'CRM_Core_DAO_SystemLog',
203 'localizable' => 0,
204 'add' => '4.5',
205 ],
206 'hostname' => [
207 'name' => 'hostname',
208 'type' => CRM_Utils_Type::T_STRING,
209 'title' => ts('Log Host'),
210 'description' => ts('Optional Name of logging host'),
211 'maxlength' => 128,
212 'size' => CRM_Utils_Type::HUGE,
213 'where' => 'civicrm_system_log.hostname',
214 'table_name' => 'civicrm_system_log',
215 'entity' => 'SystemLog',
216 'bao' => 'CRM_Core_DAO_SystemLog',
217 'localizable' => 0,
218 'add' => '4.5',
219 ],
220 ];
221 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
222 }
223 return Civi::$statics[__CLASS__]['fields'];
224 }
225
226 /**
227 * Return a mapping from field-name to the corresponding key (as used in fields()).
228 *
229 * @return array
230 * Array(string $name => string $uniqueName).
231 */
232 public static function &fieldKeys() {
233 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
234 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
235 }
236 return Civi::$statics[__CLASS__]['fieldKeys'];
237 }
238
239 /**
240 * Returns the names of this table
241 *
242 * @return string
243 */
244 public static function getTableName() {
245 return self::$_tableName;
246 }
247
248 /**
249 * Returns if this table needs to be logged
250 *
251 * @return bool
252 */
253 public function getLog() {
254 return self::$_log;
255 }
256
257 /**
258 * Returns the list of fields that can be imported
259 *
260 * @param bool $prefix
261 *
262 * @return array
263 */
264 public static function &import($prefix = FALSE) {
265 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'system_log', $prefix, []);
266 return $r;
267 }
268
269 /**
270 * Returns the list of fields that can be exported
271 *
272 * @param bool $prefix
273 *
274 * @return array
275 */
276 public static function &export($prefix = FALSE) {
277 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'system_log', $prefix, []);
278 return $r;
279 }
280
281 /**
282 * Returns the list of indices
283 *
284 * @param bool $localize
285 *
286 * @return array
287 */
288 public static function indices($localize = TRUE) {
289 $indices = [];
290 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
291 }
292
293 }