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