81fe117fbf9e36f77035bce8c041b637c15eaf11
[civicrm-core.git] / CRM / Core / DAO / Job.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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-2017
30 *
31 * Generated from xml/schema/CRM/Core/Job.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:c3340527b2d2cb17211eba848371b469)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Core_DAO_Job constructor.
39 */
40 class CRM_Core_DAO_Job extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_job';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Job Id
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Which Domain is this scheduled job for
61 *
62 * @var int unsigned
63 */
64 public $domain_id;
65 /**
66 * Scheduled job run frequency.
67 *
68 * @var string
69 */
70 public $run_frequency;
71 /**
72 * When was this cron entry last run
73 *
74 * @var datetime
75 */
76 public $last_run;
77 /**
78 * When is this cron entry scheduled to run
79 *
80 * @var timestamp
81 */
82 public $scheduled_run_date;
83 /**
84 * Title of the job
85 *
86 * @var string
87 */
88 public $name;
89 /**
90 * Description of the job
91 *
92 * @var string
93 */
94 public $description;
95 /**
96 * Entity of the job api call
97 *
98 * @var string
99 */
100 public $api_entity;
101 /**
102 * Action of the job api call
103 *
104 * @var string
105 */
106 public $api_action;
107 /**
108 * List of parameters to the command.
109 *
110 * @var text
111 */
112 public $parameters;
113 /**
114 * Is this job active?
115 *
116 * @var boolean
117 */
118 public $is_active;
119 /**
120 * Class constructor.
121 */
122 function __construct() {
123 $this->__table = 'civicrm_job';
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 (!isset(Civi::$statics[__CLASS__]['links'])) {
134 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
135 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
136 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
137 }
138 return Civi::$statics[__CLASS__]['links'];
139 }
140 /**
141 * Returns all the column names of this table
142 *
143 * @return array
144 */
145 static function &fields() {
146 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
147 Civi::$statics[__CLASS__]['fields'] = array(
148 'id' => array(
149 'name' => 'id',
150 'type' => CRM_Utils_Type::T_INT,
151 'title' => ts('Job ID') ,
152 'description' => 'Job Id',
153 'required' => true,
154 'table_name' => 'civicrm_job',
155 'entity' => 'Job',
156 'bao' => 'CRM_Core_BAO_Job',
157 ) ,
158 'domain_id' => array(
159 'name' => 'domain_id',
160 'type' => CRM_Utils_Type::T_INT,
161 'title' => ts('Job Domain') ,
162 'description' => 'Which Domain is this scheduled job for',
163 'required' => true,
164 'table_name' => 'civicrm_job',
165 'entity' => 'Job',
166 'bao' => 'CRM_Core_BAO_Job',
167 'FKClassName' => 'CRM_Core_DAO_Domain',
168 'pseudoconstant' => array(
169 'table' => 'civicrm_domain',
170 'keyColumn' => 'id',
171 'labelColumn' => 'name',
172 )
173 ) ,
174 'run_frequency' => array(
175 'name' => 'run_frequency',
176 'type' => CRM_Utils_Type::T_STRING,
177 'title' => ts('Job Frequency') ,
178 'description' => 'Scheduled job run frequency.',
179 'maxlength' => 8,
180 'size' => CRM_Utils_Type::EIGHT,
181 'default' => 'Daily',
182 'table_name' => 'civicrm_job',
183 'entity' => 'Job',
184 'bao' => 'CRM_Core_BAO_Job',
185 'html' => array(
186 'type' => 'Select',
187 ) ,
188 'pseudoconstant' => array(
189 'callback' => 'CRM_Core_SelectValues::getJobFrequency',
190 )
191 ) ,
192 'last_run' => array(
193 'name' => 'last_run',
194 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
195 'title' => ts('Last Run') ,
196 'description' => 'When was this cron entry last run',
197 'default' => 'NULL',
198 'table_name' => 'civicrm_job',
199 'entity' => 'Job',
200 'bao' => 'CRM_Core_BAO_Job',
201 ) ,
202 'scheduled_run_date' => array(
203 'name' => 'scheduled_run_date',
204 'type' => CRM_Utils_Type::T_TIMESTAMP,
205 'title' => ts('Scheduled Run Date') ,
206 'description' => 'When is this cron entry scheduled to run',
207 'required' => false,
208 'default' => 'NULL',
209 'table_name' => 'civicrm_job',
210 'entity' => 'Job',
211 'bao' => 'CRM_Core_BAO_Job',
212 ) ,
213 'name' => array(
214 'name' => 'name',
215 'type' => CRM_Utils_Type::T_STRING,
216 'title' => ts('Job Name') ,
217 'description' => 'Title of the job',
218 'maxlength' => 255,
219 'size' => CRM_Utils_Type::HUGE,
220 'table_name' => 'civicrm_job',
221 'entity' => 'Job',
222 'bao' => 'CRM_Core_BAO_Job',
223 ) ,
224 'description' => array(
225 'name' => 'description',
226 'type' => CRM_Utils_Type::T_STRING,
227 'title' => ts('Job Description') ,
228 'description' => 'Description of the job',
229 'maxlength' => 255,
230 'size' => CRM_Utils_Type::HUGE,
231 'table_name' => 'civicrm_job',
232 'entity' => 'Job',
233 'bao' => 'CRM_Core_BAO_Job',
234 ) ,
235 'api_entity' => array(
236 'name' => 'api_entity',
237 'type' => CRM_Utils_Type::T_STRING,
238 'title' => ts('API Entity') ,
239 'description' => 'Entity of the job api call',
240 'maxlength' => 255,
241 'size' => CRM_Utils_Type::HUGE,
242 'table_name' => 'civicrm_job',
243 'entity' => 'Job',
244 'bao' => 'CRM_Core_BAO_Job',
245 ) ,
246 'api_action' => array(
247 'name' => 'api_action',
248 'type' => CRM_Utils_Type::T_STRING,
249 'title' => ts('API Action') ,
250 'description' => 'Action of the job api call',
251 'maxlength' => 255,
252 'size' => CRM_Utils_Type::HUGE,
253 'table_name' => 'civicrm_job',
254 'entity' => 'Job',
255 'bao' => 'CRM_Core_BAO_Job',
256 ) ,
257 'parameters' => array(
258 'name' => 'parameters',
259 'type' => CRM_Utils_Type::T_TEXT,
260 'title' => ts('API Parameters') ,
261 'description' => 'List of parameters to the command.',
262 'rows' => 4,
263 'cols' => 60,
264 'table_name' => 'civicrm_job',
265 'entity' => 'Job',
266 'bao' => 'CRM_Core_BAO_Job',
267 'html' => array(
268 'type' => 'TextArea',
269 ) ,
270 ) ,
271 'is_active' => array(
272 'name' => 'is_active',
273 'type' => CRM_Utils_Type::T_BOOLEAN,
274 'title' => ts('Job Is Active?') ,
275 'description' => 'Is this job active?',
276 'table_name' => 'civicrm_job',
277 'entity' => 'Job',
278 'bao' => 'CRM_Core_BAO_Job',
279 ) ,
280 );
281 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
282 }
283 return Civi::$statics[__CLASS__]['fields'];
284 }
285 /**
286 * Return a mapping from field-name to the corresponding key (as used in fields()).
287 *
288 * @return array
289 * Array(string $name => string $uniqueName).
290 */
291 static function &fieldKeys() {
292 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
293 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
294 }
295 return Civi::$statics[__CLASS__]['fieldKeys'];
296 }
297 /**
298 * Returns the names of this table
299 *
300 * @return string
301 */
302 static function getTableName() {
303 return self::$_tableName;
304 }
305 /**
306 * Returns if this table needs to be logged
307 *
308 * @return boolean
309 */
310 function getLog() {
311 return self::$_log;
312 }
313 /**
314 * Returns the list of fields that can be imported
315 *
316 * @param bool $prefix
317 *
318 * @return array
319 */
320 static function &import($prefix = false) {
321 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job', $prefix, array());
322 return $r;
323 }
324 /**
325 * Returns the list of fields that can be exported
326 *
327 * @param bool $prefix
328 *
329 * @return array
330 */
331 static function &export($prefix = false) {
332 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job', $prefix, array());
333 return $r;
334 }
335 }