Merge pull request #13258 from eileenmcnaughton/isam
[civicrm-core.git] / CRM / Core / DAO / JobLog.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/JobLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e380ee3b 9 * (GenCodeChecksum:68e8b90d050e64feef2b1868d83a7923)
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 */
22 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 */
c3fc2621
CW
29 static $_log = FALSE;
30
e501603b
TO
31 /**
32 * Job log entry Id
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Which Domain is this scheduled job for
40 *
41 * @var int unsigned
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 *
55 * @var int unsigned
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
e501603b 95 /**
f41f0342 96 * Returns foreign keys and entity references.
e501603b
TO
97 *
98 * @return array
99 * [CRM_Core_Reference_Interface]
100 */
c3fc2621 101 public static function getReferenceColumns() {
346aaaba
TO
102 if (!isset(Civi::$statics[__CLASS__]['links'])) {
103 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
c3fc2621 104 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
346aaaba 105 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 106 }
346aaaba 107 return Civi::$statics[__CLASS__]['links'];
e501603b 108 }
c3fc2621 109
e501603b
TO
110 /**
111 * Returns all the column names of this table
112 *
113 * @return array
114 */
c3fc2621 115 public static function &fields() {
346aaaba 116 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
117 Civi::$statics[__CLASS__]['fields'] = [
118 'id' => [
e501603b
TO
119 'name' => 'id',
120 'type' => CRM_Utils_Type::T_INT,
c3fc2621 121 'title' => ts('Job Log ID'),
215b423e 122 'description' => ts('Job log entry Id'),
c3fc2621 123 'required' => TRUE,
522a26c9 124 'table_name' => 'civicrm_job_log',
125 'entity' => 'JobLog',
126 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 127 'localizable' => 0,
c3fc2621
CW
128 ],
129 'domain_id' => [
e501603b
TO
130 'name' => 'domain_id',
131 'type' => CRM_Utils_Type::T_INT,
c3fc2621 132 'title' => ts('Domain ID'),
215b423e 133 'description' => ts('Which Domain is this scheduled job for'),
c3fc2621 134 'required' => TRUE,
522a26c9 135 'table_name' => 'civicrm_job_log',
136 'entity' => 'JobLog',
137 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 138 'localizable' => 0,
e501603b 139 'FKClassName' => 'CRM_Core_DAO_Domain',
c3fc2621 140 'pseudoconstant' => [
e501603b
TO
141 'table' => 'civicrm_domain',
142 'keyColumn' => 'id',
143 'labelColumn' => 'name',
c3fc2621
CW
144 ]
145 ],
146 'run_time' => [
e501603b
TO
147 'name' => 'run_time',
148 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 149 'title' => ts('Timestamp'),
215b423e 150 'description' => ts('Log entry date'),
522a26c9 151 'table_name' => 'civicrm_job_log',
152 'entity' => 'JobLog',
153 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 154 'localizable' => 0,
c3fc2621
CW
155 ],
156 'job_id' => [
e501603b
TO
157 'name' => 'job_id',
158 'type' => CRM_Utils_Type::T_INT,
c3fc2621 159 'title' => ts('Job ID'),
215b423e 160 'description' => ts('Pointer to job id - not a FK though, just for logging purposes'),
522a26c9 161 'table_name' => 'civicrm_job_log',
162 'entity' => 'JobLog',
163 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 164 'localizable' => 0,
c3fc2621
CW
165 ],
166 'name' => [
e501603b
TO
167 'name' => 'name',
168 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 169 'title' => ts('Job Name'),
215b423e 170 'description' => ts('Title of the job'),
e501603b
TO
171 'maxlength' => 255,
172 'size' => CRM_Utils_Type::HUGE,
522a26c9 173 'table_name' => 'civicrm_job_log',
174 'entity' => 'JobLog',
175 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 176 'localizable' => 0,
c3fc2621
CW
177 ],
178 'command' => [
e501603b
TO
179 'name' => 'command',
180 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 181 'title' => ts('Command'),
215b423e 182 'description' => ts('Full path to file containing job script'),
e501603b
TO
183 'maxlength' => 255,
184 'size' => CRM_Utils_Type::HUGE,
522a26c9 185 'table_name' => 'civicrm_job_log',
186 'entity' => 'JobLog',
187 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 188 'localizable' => 0,
c3fc2621
CW
189 ],
190 'description' => [
e501603b
TO
191 'name' => 'description',
192 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 193 'title' => ts('Description'),
215b423e 194 'description' => ts('Title line of log entry'),
e501603b
TO
195 'maxlength' => 255,
196 'size' => CRM_Utils_Type::HUGE,
522a26c9 197 'table_name' => 'civicrm_job_log',
198 'entity' => 'JobLog',
199 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 200 'localizable' => 0,
c3fc2621
CW
201 ],
202 'data' => [
e501603b
TO
203 'name' => 'data',
204 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 205 'title' => ts('Extended Data'),
215b423e 206 'description' => ts('Potential extended data for specific job run (e.g. tracebacks).'),
522a26c9 207 'table_name' => 'civicrm_job_log',
208 'entity' => 'JobLog',
209 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 210 'localizable' => 0,
c3fc2621
CW
211 ],
212 ];
346aaaba 213 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 214 }
346aaaba 215 return Civi::$statics[__CLASS__]['fields'];
e501603b 216 }
c3fc2621 217
e501603b 218 /**
bd8e0b14 219 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
220 *
221 * @return array
bd8e0b14 222 * Array(string $name => string $uniqueName).
e501603b 223 */
c3fc2621 224 public static function &fieldKeys() {
bd8e0b14
TO
225 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
226 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 227 }
bd8e0b14 228 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 229 }
c3fc2621 230
e501603b
TO
231 /**
232 * Returns the names of this table
233 *
234 * @return string
235 */
c3fc2621 236 public static function getTableName() {
e501603b
TO
237 return self::$_tableName;
238 }
c3fc2621 239
e501603b
TO
240 /**
241 * Returns if this table needs to be logged
242 *
c3fc2621 243 * @return bool
e501603b 244 */
c3fc2621 245 public function getLog() {
e501603b
TO
246 return self::$_log;
247 }
c3fc2621 248
e501603b
TO
249 /**
250 * Returns the list of fields that can be imported
251 *
252 * @param bool $prefix
253 *
254 * @return array
255 */
c3fc2621
CW
256 public static function &import($prefix = FALSE) {
257 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job_log', $prefix, []);
60808919 258 return $r;
e501603b 259 }
c3fc2621 260
e501603b
TO
261 /**
262 * Returns the list of fields that can be exported
263 *
264 * @param bool $prefix
265 *
266 * @return array
267 */
c3fc2621
CW
268 public static function &export($prefix = FALSE) {
269 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job_log', $prefix, []);
60808919 270 return $r;
e501603b 271 }
c3fc2621 272
e7a6b91a
AS
273 /**
274 * Returns the list of indices
c3fc2621
CW
275 *
276 * @param bool $localize
277 *
278 * @return array
e7a6b91a
AS
279 */
280 public static function indices($localize = TRUE) {
c3fc2621 281 $indices = [];
e7a6b91a
AS
282 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
283 }
c3fc2621 284
e501603b 285}