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