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