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