xml/templates/dao.tpl - Simplify fieldKeys()
[civicrm-core.git] / CRM / Core / DAO / JobLog.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Core/JobLog.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:4b0845059b2070b57b02b8b1c6c9df50)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_JobLog extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_job_log';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
e501603b
TO
62 /**
63 * static value to see if we should log any modifications to
64 * this table in the civicrm_log table
65 *
66 * @var boolean
67 */
68 static $_log = false;
69 /**
70 * Job log entry Id
71 *
72 * @var int unsigned
73 */
74 public $id;
75 /**
76 * Which Domain is this scheduled job for
77 *
78 * @var int unsigned
79 */
80 public $domain_id;
81 /**
82 * Log entry date
83 *
84 * @var timestamp
85 */
86 public $run_time;
87 /**
88 * Pointer to job id - not a FK though, just for logging purposes
89 *
90 * @var int unsigned
91 */
92 public $job_id;
93 /**
94 * Title of the job
95 *
96 * @var string
97 */
98 public $name;
99 /**
100 * Full path to file containing job script
101 *
102 * @var string
103 */
104 public $command;
105 /**
106 * Title line of log entry
107 *
108 * @var string
109 */
110 public $description;
111 /**
112 * Potential extended data for specific job run (e.g. tracebacks).
113 *
114 * @var text
115 */
116 public $data;
117 /**
118 * class constructor
119 *
120 * @return civicrm_job_log
121 */
122 function __construct() {
123 $this->__table = 'civicrm_job_log';
124 parent::__construct();
125 }
126 /**
127 * Returns foreign keys and entity references
128 *
129 * @return array
130 * [CRM_Core_Reference_Interface]
131 */
132 static function getReferenceColumns() {
133 if (!self::$_links) {
134 self::$_links = static ::createReferenceColumns(__CLASS__);
135 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
136 }
137 return self::$_links;
138 }
139 /**
140 * Returns all the column names of this table
141 *
142 * @return array
143 */
144 static function &fields() {
145 if (!(self::$_fields)) {
146 self::$_fields = array(
147 'id' => array(
148 'name' => 'id',
149 'type' => CRM_Utils_Type::T_INT,
150 'title' => ts('Job Log ID') ,
151 'description' => 'Job log entry Id',
152 'required' => true,
153 ) ,
154 'domain_id' => array(
155 'name' => 'domain_id',
156 'type' => CRM_Utils_Type::T_INT,
157 'title' => ts('Domain ID') ,
158 'description' => 'Which Domain is this scheduled job for',
159 'required' => true,
160 'FKClassName' => 'CRM_Core_DAO_Domain',
161 'pseudoconstant' => array(
162 'table' => 'civicrm_domain',
163 'keyColumn' => 'id',
164 'labelColumn' => 'name',
165 )
166 ) ,
167 'run_time' => array(
168 'name' => 'run_time',
169 'type' => CRM_Utils_Type::T_TIMESTAMP,
170 'title' => ts('Timestamp') ,
171 'description' => 'Log entry date',
172 ) ,
173 'job_id' => array(
174 'name' => 'job_id',
175 'type' => CRM_Utils_Type::T_INT,
176 'title' => ts('Job ID') ,
177 'description' => 'Pointer to job id - not a FK though, just for logging purposes',
178 ) ,
179 'name' => array(
180 'name' => 'name',
181 'type' => CRM_Utils_Type::T_STRING,
182 'title' => ts('Job Name') ,
183 'description' => 'Title of the job',
184 'maxlength' => 255,
185 'size' => CRM_Utils_Type::HUGE,
186 ) ,
187 'command' => array(
188 'name' => 'command',
189 'type' => CRM_Utils_Type::T_STRING,
190 'title' => ts('Command') ,
191 'description' => 'Full path to file containing job script',
192 'maxlength' => 255,
193 'size' => CRM_Utils_Type::HUGE,
194 ) ,
195 'description' => array(
196 'name' => 'description',
197 'type' => CRM_Utils_Type::T_STRING,
198 'title' => ts('Description') ,
199 'description' => 'Title line of log entry',
200 'maxlength' => 255,
201 'size' => CRM_Utils_Type::HUGE,
202 ) ,
203 'data' => array(
204 'name' => 'data',
205 'type' => CRM_Utils_Type::T_TEXT,
206 'title' => ts('Extended Data') ,
207 'description' => 'Potential extended data for specific job run (e.g. tracebacks).',
208 ) ,
209 );
210 }
211 return self::$_fields;
212 }
213 /**
214 * Returns an array containing, for each field, the arary key used for that
215 * field in self::$_fields.
216 *
217 * @return array
218 */
219 static function &fieldKeys() {
220 if (!(self::$_fieldKeys)) {
221 self::$_fieldKeys = array(
222 'id' => 'id',
223 'domain_id' => 'domain_id',
224 'run_time' => 'run_time',
225 'job_id' => 'job_id',
226 'name' => 'name',
227 'command' => 'command',
228 'description' => 'description',
229 'data' => 'data',
230 );
231 }
232 return self::$_fieldKeys;
233 }
234 /**
235 * Returns the names of this table
236 *
237 * @return string
238 */
239 static function getTableName() {
240 return self::$_tableName;
241 }
242 /**
243 * Returns if this table needs to be logged
244 *
245 * @return boolean
246 */
247 function getLog() {
248 return self::$_log;
249 }
250 /**
251 * Returns the list of fields that can be imported
252 *
253 * @param bool $prefix
254 *
255 * @return array
256 */
257 static function &import($prefix = false) {
60808919
TO
258 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job_log', $prefix, array());
259 return $r;
e501603b
TO
260 }
261 /**
262 * Returns the list of fields that can be exported
263 *
264 * @param bool $prefix
265 *
266 * @return array
267 */
268 static function &export($prefix = false) {
60808919
TO
269 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job_log', $prefix, array());
270 return $r;
e501603b
TO
271 }
272}