Merge pull request #22336 from braders/crm-core-extension-typo
[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:6677b28207cbf86835164b7b33c38608)
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 'html' => [
142 'type' => 'Number',
143 ],
144 'readonly' => TRUE,
145 'add' => '4.1',
146 ],
147 'domain_id' => [
148 'name' => 'domain_id',
149 'type' => CRM_Utils_Type::T_INT,
150 'title' => ts('Domain ID'),
151 'description' => ts('Which Domain is this scheduled job for'),
152 'required' => TRUE,
153 'where' => 'civicrm_job_log.domain_id',
154 'table_name' => 'civicrm_job_log',
155 'entity' => 'JobLog',
156 'bao' => 'CRM_Core_DAO_JobLog',
157 'localizable' => 0,
158 'FKClassName' => 'CRM_Core_DAO_Domain',
159 'html' => [
160 'label' => ts("Domain"),
161 ],
162 'pseudoconstant' => [
163 'table' => 'civicrm_domain',
164 'keyColumn' => 'id',
165 'labelColumn' => 'name',
166 ],
167 'add' => '4.1',
168 ],
169 'run_time' => [
170 'name' => 'run_time',
171 'type' => CRM_Utils_Type::T_TIMESTAMP,
172 'title' => ts('Timestamp'),
173 'description' => ts('Log entry date'),
174 'where' => 'civicrm_job_log.run_time',
175 'table_name' => 'civicrm_job_log',
176 'entity' => 'JobLog',
177 'bao' => 'CRM_Core_DAO_JobLog',
178 'localizable' => 0,
179 'add' => '4.1',
180 ],
181 'job_id' => [
182 'name' => 'job_id',
183 'type' => CRM_Utils_Type::T_INT,
184 'title' => ts('Job ID'),
185 'description' => ts('Pointer to job id - not a FK though, just for logging purposes'),
186 'where' => 'civicrm_job_log.job_id',
187 'table_name' => 'civicrm_job_log',
188 'entity' => 'JobLog',
189 'bao' => 'CRM_Core_DAO_JobLog',
190 'localizable' => 0,
191 'add' => '4.1',
192 ],
193 'name' => [
194 'name' => 'name',
195 'type' => CRM_Utils_Type::T_STRING,
196 'title' => ts('Job Name'),
197 'description' => ts('Title of the job'),
198 'maxlength' => 255,
199 'size' => CRM_Utils_Type::HUGE,
200 'where' => 'civicrm_job_log.name',
201 'table_name' => 'civicrm_job_log',
202 'entity' => 'JobLog',
203 'bao' => 'CRM_Core_DAO_JobLog',
204 'localizable' => 0,
205 'add' => '4.1',
206 ],
207 'command' => [
208 'name' => 'command',
209 'type' => CRM_Utils_Type::T_STRING,
210 'title' => ts('Command'),
211 'description' => ts('Full path to file containing job script'),
212 'maxlength' => 255,
213 'size' => CRM_Utils_Type::HUGE,
214 'where' => 'civicrm_job_log.command',
215 'table_name' => 'civicrm_job_log',
216 'entity' => 'JobLog',
217 'bao' => 'CRM_Core_DAO_JobLog',
218 'localizable' => 0,
219 'add' => '4.1',
220 ],
221 'description' => [
222 'name' => 'description',
223 'type' => CRM_Utils_Type::T_STRING,
224 'title' => ts('Description'),
225 'description' => ts('Title line of log entry'),
226 'maxlength' => 255,
227 'size' => CRM_Utils_Type::HUGE,
228 'where' => 'civicrm_job_log.description',
229 'table_name' => 'civicrm_job_log',
230 'entity' => 'JobLog',
231 'bao' => 'CRM_Core_DAO_JobLog',
232 'localizable' => 0,
233 'add' => '4.1',
234 ],
235 'data' => [
236 'name' => 'data',
237 'type' => CRM_Utils_Type::T_TEXT,
238 'title' => ts('Extended Data'),
239 'description' => ts('Potential extended data for specific job run (e.g. tracebacks).'),
240 'where' => 'civicrm_job_log.data',
241 'table_name' => 'civicrm_job_log',
242 'entity' => 'JobLog',
243 'bao' => 'CRM_Core_DAO_JobLog',
244 'localizable' => 0,
245 'add' => '4.1',
246 ],
247 ];
248 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
249 }
250 return Civi::$statics[__CLASS__]['fields'];
251 }
252
253 /**
254 * Return a mapping from field-name to the corresponding key (as used in fields()).
255 *
256 * @return array
257 * Array(string $name => string $uniqueName).
258 */
259 public static function &fieldKeys() {
260 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
261 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
262 }
263 return Civi::$statics[__CLASS__]['fieldKeys'];
264 }
265
266 /**
267 * Returns the names of this table
268 *
269 * @return string
270 */
271 public static function getTableName() {
272 return self::$_tableName;
273 }
274
275 /**
276 * Returns if this table needs to be logged
277 *
278 * @return bool
279 */
280 public function getLog() {
281 return self::$_log;
282 }
283
284 /**
285 * Returns the list of fields that can be imported
286 *
287 * @param bool $prefix
288 *
289 * @return array
290 */
291 public static function &import($prefix = FALSE) {
292 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job_log', $prefix, []);
293 return $r;
294 }
295
296 /**
297 * Returns the list of fields that can be exported
298 *
299 * @param bool $prefix
300 *
301 * @return array
302 */
303 public static function &export($prefix = FALSE) {
304 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job_log', $prefix, []);
305 return $r;
306 }
307
308 /**
309 * Returns the list of indices
310 *
311 * @param bool $localize
312 *
313 * @return array
314 */
315 public static function indices($localize = TRUE) {
316 $indices = [];
317 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
318 }
319
320 }