xml/templates/dao.tpl - Simplify fieldKeys()
[civicrm-core.git] / CRM / Core / DAO / Job.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/Job.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:5c0e5cb30a7aaee5be8f3a2e6d23b84b)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_Job extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_job';
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 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 * Scheduled job run frequency.
83 *
84 * @var string
85 */
86 public $run_frequency;
87 /**
88 * When was this cron entry last run
89 *
90 * @var datetime
91 */
92 public $last_run;
93 /**
94 * When is this cron entry scheduled to run
95 *
96 * @var timestamp
97 */
98 public $scheduled_run_date;
99 /**
100 * Title of the job
101 *
102 * @var string
103 */
104 public $name;
105 /**
106 * Description of the job
107 *
108 * @var string
109 */
110 public $description;
111 /**
112 * Entity of the job api call
113 *
114 * @var string
115 */
116 public $api_entity;
117 /**
118 * Action of the job api call
119 *
120 * @var string
121 */
122 public $api_action;
123 /**
124 * List of parameters to the command.
125 *
126 * @var text
127 */
128 public $parameters;
129 /**
130 * Is this job active?
131 *
132 * @var boolean
133 */
134 public $is_active;
135 /**
136 * class constructor
137 *
138 * @return civicrm_job
139 */
140 function __construct() {
141 $this->__table = 'civicrm_job';
142 parent::__construct();
143 }
144 /**
145 * Returns foreign keys and entity references
146 *
147 * @return array
148 * [CRM_Core_Reference_Interface]
149 */
150 static function getReferenceColumns() {
151 if (!self::$_links) {
152 self::$_links = static ::createReferenceColumns(__CLASS__);
153 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
154 }
155 return self::$_links;
156 }
157 /**
158 * Returns all the column names of this table
159 *
160 * @return array
161 */
162 static function &fields() {
163 if (!(self::$_fields)) {
164 self::$_fields = array(
165 'id' => array(
166 'name' => 'id',
167 'type' => CRM_Utils_Type::T_INT,
168 'title' => ts('Job ID') ,
169 'description' => 'Job Id',
170 'required' => true,
171 ) ,
172 'domain_id' => array(
173 'name' => 'domain_id',
174 'type' => CRM_Utils_Type::T_INT,
175 'title' => ts('Job Domain') ,
176 'description' => 'Which Domain is this scheduled job for',
177 'required' => true,
178 'FKClassName' => 'CRM_Core_DAO_Domain',
179 'pseudoconstant' => array(
180 'table' => 'civicrm_domain',
181 'keyColumn' => 'id',
182 'labelColumn' => 'name',
183 )
184 ) ,
185 'run_frequency' => array(
186 'name' => 'run_frequency',
187 'type' => CRM_Utils_Type::T_STRING,
188 'title' => ts('Job Frequency') ,
189 'description' => 'Scheduled job run frequency.',
190 'maxlength' => 8,
191 'size' => CRM_Utils_Type::EIGHT,
192 'default' => 'Daily',
193 'html' => array(
194 'type' => 'Select',
195 ) ,
196 'pseudoconstant' => array(
197 'callback' => 'CRM_Core_SelectValues::getJobFrequency',
198 )
199 ) ,
200 'last_run' => array(
201 'name' => 'last_run',
202 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
203 'title' => ts('Last Run') ,
204 'description' => 'When was this cron entry last run',
205 'default' => 'NULL',
206 ) ,
207 'scheduled_run_date' => array(
208 'name' => 'scheduled_run_date',
209 'type' => CRM_Utils_Type::T_TIMESTAMP,
210 'title' => ts('Scheduled Run Date') ,
211 'description' => 'When is this cron entry scheduled to run',
212 'required' => false,
213 'default' => 'NULL',
214 ) ,
215 'name' => array(
216 'name' => 'name',
217 'type' => CRM_Utils_Type::T_STRING,
218 'title' => ts('Job Name') ,
219 'description' => 'Title of the job',
220 'maxlength' => 255,
221 'size' => CRM_Utils_Type::HUGE,
222 ) ,
223 'description' => array(
224 'name' => 'description',
225 'type' => CRM_Utils_Type::T_STRING,
226 'title' => ts('Job Description') ,
227 'description' => 'Description of the job',
228 'maxlength' => 255,
229 'size' => CRM_Utils_Type::HUGE,
230 ) ,
231 'api_entity' => array(
232 'name' => 'api_entity',
233 'type' => CRM_Utils_Type::T_STRING,
234 'title' => ts('API Entity') ,
235 'description' => 'Entity of the job api call',
236 'maxlength' => 255,
237 'size' => CRM_Utils_Type::HUGE,
238 ) ,
239 'api_action' => array(
240 'name' => 'api_action',
241 'type' => CRM_Utils_Type::T_STRING,
242 'title' => ts('API Action') ,
243 'description' => 'Action of the job api call',
244 'maxlength' => 255,
245 'size' => CRM_Utils_Type::HUGE,
246 ) ,
247 'parameters' => array(
248 'name' => 'parameters',
249 'type' => CRM_Utils_Type::T_TEXT,
250 'title' => ts('API Parameters') ,
251 'description' => 'List of parameters to the command.',
252 'rows' => 4,
253 'cols' => 60,
254 'html' => array(
255 'type' => 'TextArea',
256 ) ,
257 ) ,
258 'is_active' => array(
259 'name' => 'is_active',
260 'type' => CRM_Utils_Type::T_BOOLEAN,
261 'title' => ts('Job Is Active?') ,
262 'description' => 'Is this job active?',
263 ) ,
264 );
265 }
266 return self::$_fields;
267 }
268 /**
269 * Returns an array containing, for each field, the arary key used for that
270 * field in self::$_fields.
271 *
272 * @return array
273 */
274 static function &fieldKeys() {
275 if (!(self::$_fieldKeys)) {
276 self::$_fieldKeys = array(
277 'id' => 'id',
278 'domain_id' => 'domain_id',
279 'run_frequency' => 'run_frequency',
280 'last_run' => 'last_run',
281 'scheduled_run_date' => 'scheduled_run_date',
282 'name' => 'name',
283 'description' => 'description',
284 'api_entity' => 'api_entity',
285 'api_action' => 'api_action',
286 'parameters' => 'parameters',
287 'is_active' => 'is_active',
288 );
289 }
290 return self::$_fieldKeys;
291 }
292 /**
293 * Returns the names of this table
294 *
295 * @return string
296 */
297 static function getTableName() {
298 return self::$_tableName;
299 }
300 /**
301 * Returns if this table needs to be logged
302 *
303 * @return boolean
304 */
305 function getLog() {
306 return self::$_log;
307 }
308 /**
309 * Returns the list of fields that can be imported
310 *
311 * @param bool $prefix
312 *
313 * @return array
314 */
315 static function &import($prefix = false) {
60808919
TO
316 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job', $prefix, array());
317 return $r;
e501603b
TO
318 }
319 /**
320 * Returns the list of fields that can be exported
321 *
322 * @param bool $prefix
323 *
324 * @return array
325 */
326 static function &export($prefix = false) {
60808919
TO
327 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job', $prefix, array());
328 return $r;
e501603b
TO
329 }
330}