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