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