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