API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Core / DAO / JobLog.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/JobLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:d5266d899de027b3411970632fd2d6ef)
10 */
11
12 /**
13 * Database access object for the JobLog entity.
14 */
15 class CRM_Core_DAO_JobLog extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_job_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 * Job log entry Id
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Which Domain is this scheduled job for
40 *
41 * @var int
42 */
43 public $domain_id;
44
45 /**
46 * Log entry date
47 *
48 * @var timestamp
49 */
50 public $run_time;
51
52 /**
53 * Pointer to job id - not a FK though, just for logging purposes
54 *
55 * @var int
56 */
57 public $job_id;
58
59 /**
60 * Title of the job
61 *
62 * @var string
63 */
64 public $name;
65
66 /**
67 * Full path to file containing job script
68 *
69 * @var string
70 */
71 public $command;
72
73 /**
74 * Title line of log entry
75 *
76 * @var string
77 */
78 public $description;
79
80 /**
81 * Potential extended data for specific job run (e.g. tracebacks).
82 *
83 * @var text
84 */
85 public $data;
86
87 /**
88 * Class constructor.
89 */
90 public function __construct() {
91 $this->__table = 'civicrm_job_log';
92 parent::__construct();
93 }
94
95 /**
96 * Returns localized title of this entity.
97 */
98 public static function getEntityTitle() {
99 return ts('Job Logs');
100 }
101
102 /**
103 * Returns foreign keys and entity references.
104 *
105 * @return array
106 * [CRM_Core_Reference_Interface]
107 */
108 public static function getReferenceColumns() {
109 if (!isset(Civi::$statics[__CLASS__]['links'])) {
110 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
111 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
112 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
113 }
114 return Civi::$statics[__CLASS__]['links'];
115 }
116
117 /**
118 * Returns all the column names of this table
119 *
120 * @return array
121 */
122 public static function &fields() {
123 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
124 Civi::$statics[__CLASS__]['fields'] = [
125 'id' => [
126 'name' => 'id',
127 'type' => CRM_Utils_Type::T_INT,
128 'title' => ts('Job Log ID'),
129 'description' => ts('Job log entry Id'),
130 'required' => TRUE,
131 'where' => 'civicrm_job_log.id',
132 'table_name' => 'civicrm_job_log',
133 'entity' => 'JobLog',
134 'bao' => 'CRM_Core_DAO_JobLog',
135 'localizable' => 0,
136 'add' => '4.1',
137 ],
138 'domain_id' => [
139 'name' => 'domain_id',
140 'type' => CRM_Utils_Type::T_INT,
141 'title' => ts('Domain ID'),
142 'description' => ts('Which Domain is this scheduled job for'),
143 'required' => TRUE,
144 'where' => 'civicrm_job_log.domain_id',
145 'table_name' => 'civicrm_job_log',
146 'entity' => 'JobLog',
147 'bao' => 'CRM_Core_DAO_JobLog',
148 'localizable' => 0,
149 'FKClassName' => 'CRM_Core_DAO_Domain',
150 'pseudoconstant' => [
151 'table' => 'civicrm_domain',
152 'keyColumn' => 'id',
153 'labelColumn' => 'name',
154 ],
155 'add' => '4.1',
156 ],
157 'run_time' => [
158 'name' => 'run_time',
159 'type' => CRM_Utils_Type::T_TIMESTAMP,
160 'title' => ts('Timestamp'),
161 'description' => ts('Log entry date'),
162 'where' => 'civicrm_job_log.run_time',
163 'table_name' => 'civicrm_job_log',
164 'entity' => 'JobLog',
165 'bao' => 'CRM_Core_DAO_JobLog',
166 'localizable' => 0,
167 'add' => '4.1',
168 ],
169 'job_id' => [
170 'name' => 'job_id',
171 'type' => CRM_Utils_Type::T_INT,
172 'title' => ts('Job ID'),
173 'description' => ts('Pointer to job id - not a FK though, just for logging purposes'),
174 'where' => 'civicrm_job_log.job_id',
175 'table_name' => 'civicrm_job_log',
176 'entity' => 'JobLog',
177 'bao' => 'CRM_Core_DAO_JobLog',
178 'localizable' => 0,
179 'add' => '4.1',
180 ],
181 'name' => [
182 'name' => 'name',
183 'type' => CRM_Utils_Type::T_STRING,
184 'title' => ts('Job Name'),
185 'description' => ts('Title of the job'),
186 'maxlength' => 255,
187 'size' => CRM_Utils_Type::HUGE,
188 'where' => 'civicrm_job_log.name',
189 'table_name' => 'civicrm_job_log',
190 'entity' => 'JobLog',
191 'bao' => 'CRM_Core_DAO_JobLog',
192 'localizable' => 0,
193 'add' => '4.1',
194 ],
195 'command' => [
196 'name' => 'command',
197 'type' => CRM_Utils_Type::T_STRING,
198 'title' => ts('Command'),
199 'description' => ts('Full path to file containing job script'),
200 'maxlength' => 255,
201 'size' => CRM_Utils_Type::HUGE,
202 'where' => 'civicrm_job_log.command',
203 'table_name' => 'civicrm_job_log',
204 'entity' => 'JobLog',
205 'bao' => 'CRM_Core_DAO_JobLog',
206 'localizable' => 0,
207 'add' => '4.1',
208 ],
209 'description' => [
210 'name' => 'description',
211 'type' => CRM_Utils_Type::T_STRING,
212 'title' => ts('Description'),
213 'description' => ts('Title line of log entry'),
214 'maxlength' => 255,
215 'size' => CRM_Utils_Type::HUGE,
216 'where' => 'civicrm_job_log.description',
217 'table_name' => 'civicrm_job_log',
218 'entity' => 'JobLog',
219 'bao' => 'CRM_Core_DAO_JobLog',
220 'localizable' => 0,
221 'add' => '4.1',
222 ],
223 'data' => [
224 'name' => 'data',
225 'type' => CRM_Utils_Type::T_TEXT,
226 'title' => ts('Extended Data'),
227 'description' => ts('Potential extended data for specific job run (e.g. tracebacks).'),
228 'where' => 'civicrm_job_log.data',
229 'table_name' => 'civicrm_job_log',
230 'entity' => 'JobLog',
231 'bao' => 'CRM_Core_DAO_JobLog',
232 'localizable' => 0,
233 'add' => '4.1',
234 ],
235 ];
236 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
237 }
238 return Civi::$statics[__CLASS__]['fields'];
239 }
240
241 /**
242 * Return a mapping from field-name to the corresponding key (as used in fields()).
243 *
244 * @return array
245 * Array(string $name => string $uniqueName).
246 */
247 public static function &fieldKeys() {
248 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
249 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
250 }
251 return Civi::$statics[__CLASS__]['fieldKeys'];
252 }
253
254 /**
255 * Returns the names of this table
256 *
257 * @return string
258 */
259 public static function getTableName() {
260 return self::$_tableName;
261 }
262
263 /**
264 * Returns if this table needs to be logged
265 *
266 * @return bool
267 */
268 public function getLog() {
269 return self::$_log;
270 }
271
272 /**
273 * Returns the list of fields that can be imported
274 *
275 * @param bool $prefix
276 *
277 * @return array
278 */
279 public static function &import($prefix = FALSE) {
280 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job_log', $prefix, []);
281 return $r;
282 }
283
284 /**
285 * Returns the list of fields that can be exported
286 *
287 * @param bool $prefix
288 *
289 * @return array
290 */
291 public static function &export($prefix = FALSE) {
292 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job_log', $prefix, []);
293 return $r;
294 }
295
296 /**
297 * Returns the list of indices
298 *
299 * @param bool $localize
300 *
301 * @return array
302 */
303 public static function indices($localize = TRUE) {
304 $indices = [];
305 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
306 }
307
308 }