Add "labelField" metadata to entities
[civicrm-core.git] / CRM / Mailing / DAO / MailingJob.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Mailing/MailingJob.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:16d3f472e9379145910fa49ef5d2576a)
10 */
11
12 /**
13 * Database access object for the MailingJob entity.
14 */
15 class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
18 const COMPONENT = 'CiviMail';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_mailing_job';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = FALSE;
33
34 /**
35 * @var int
36 */
37 public $id;
38
39 /**
40 * The ID of the mailing this Job will send.
41 *
42 * @var int
43 */
44 public $mailing_id;
45
46 /**
47 * date on which this job was scheduled.
48 *
49 * @var timestamp
50 */
51 public $scheduled_date;
52
53 /**
54 * date on which this job was started.
55 *
56 * @var timestamp
57 */
58 public $start_date;
59
60 /**
61 * date on which this job ended.
62 *
63 * @var timestamp
64 */
65 public $end_date;
66
67 /**
68 * The state of this job
69 *
70 * @var string
71 */
72 public $status;
73
74 /**
75 * Is this job for a test mail?
76 *
77 * @var bool
78 */
79 public $is_test;
80
81 /**
82 * Type of mailling job: null | child
83 *
84 * @var string
85 */
86 public $job_type;
87
88 /**
89 * Parent job id
90 *
91 * @var int
92 */
93 public $parent_id;
94
95 /**
96 * Offset of the child job
97 *
98 * @var int
99 */
100 public $job_offset;
101
102 /**
103 * Queue size limit for each child job
104 *
105 * @var int
106 */
107 public $job_limit;
108
109 /**
110 * Class constructor.
111 */
112 public function __construct() {
113 $this->__table = 'civicrm_mailing_job';
114 parent::__construct();
115 }
116
117 /**
118 * Returns localized title of this entity.
119 *
120 * @param bool $plural
121 * Whether to return the plural version of the title.
122 */
123 public static function getEntityTitle($plural = FALSE) {
124 return $plural ? ts('Mailing Jobs') : ts('Mailing Job');
125 }
126
127 /**
128 * Returns foreign keys and entity references.
129 *
130 * @return array
131 * [CRM_Core_Reference_Interface]
132 */
133 public static function getReferenceColumns() {
134 if (!isset(Civi::$statics[__CLASS__]['links'])) {
135 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
136 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
137 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_mailing_job', 'id');
138 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
139 }
140 return Civi::$statics[__CLASS__]['links'];
141 }
142
143 /**
144 * Returns all the column names of this table
145 *
146 * @return array
147 */
148 public static function &fields() {
149 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
150 Civi::$statics[__CLASS__]['fields'] = [
151 'id' => [
152 'name' => 'id',
153 'type' => CRM_Utils_Type::T_INT,
154 'title' => ts('Mailing Job ID'),
155 'required' => TRUE,
156 'where' => 'civicrm_mailing_job.id',
157 'table_name' => 'civicrm_mailing_job',
158 'entity' => 'MailingJob',
159 'bao' => 'CRM_Mailing_BAO_MailingJob',
160 'localizable' => 0,
161 'add' => NULL,
162 ],
163 'mailing_id' => [
164 'name' => 'mailing_id',
165 'type' => CRM_Utils_Type::T_INT,
166 'title' => ts('Mailing'),
167 'description' => ts('The ID of the mailing this Job will send.'),
168 'required' => TRUE,
169 'where' => 'civicrm_mailing_job.mailing_id',
170 'table_name' => 'civicrm_mailing_job',
171 'entity' => 'MailingJob',
172 'bao' => 'CRM_Mailing_BAO_MailingJob',
173 'localizable' => 0,
174 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
175 'add' => NULL,
176 ],
177 'scheduled_date' => [
178 'name' => 'scheduled_date',
179 'type' => CRM_Utils_Type::T_TIMESTAMP,
180 'title' => ts('Mailing Scheduled Date'),
181 'description' => ts('date on which this job was scheduled.'),
182 'required' => FALSE,
183 'where' => 'civicrm_mailing_job.scheduled_date',
184 'default' => 'NULL',
185 'table_name' => 'civicrm_mailing_job',
186 'entity' => 'MailingJob',
187 'bao' => 'CRM_Mailing_BAO_MailingJob',
188 'localizable' => 0,
189 'html' => [
190 'type' => 'Select Date',
191 'formatType' => 'activityDateTime',
192 ],
193 'add' => NULL,
194 ],
195 'mailing_job_start_date' => [
196 'name' => 'start_date',
197 'type' => CRM_Utils_Type::T_TIMESTAMP,
198 'title' => ts('Mailing Job Start Date'),
199 'description' => ts('date on which this job was started.'),
200 'required' => FALSE,
201 'where' => 'civicrm_mailing_job.start_date',
202 'default' => 'NULL',
203 'table_name' => 'civicrm_mailing_job',
204 'entity' => 'MailingJob',
205 'bao' => 'CRM_Mailing_BAO_MailingJob',
206 'localizable' => 0,
207 'unique_title' => ts('Mailing Start Date'),
208 'html' => [
209 'type' => 'Select Date',
210 'formatType' => 'activityDateTime',
211 ],
212 'add' => NULL,
213 ],
214 'end_date' => [
215 'name' => 'end_date',
216 'type' => CRM_Utils_Type::T_TIMESTAMP,
217 'title' => ts('Mailing Job End Date'),
218 'description' => ts('date on which this job ended.'),
219 'required' => FALSE,
220 'where' => 'civicrm_mailing_job.end_date',
221 'default' => 'NULL',
222 'table_name' => 'civicrm_mailing_job',
223 'entity' => 'MailingJob',
224 'bao' => 'CRM_Mailing_BAO_MailingJob',
225 'localizable' => 0,
226 'html' => [
227 'type' => 'Select Date',
228 'formatType' => 'activityDateTime',
229 ],
230 'add' => NULL,
231 ],
232 'mailing_job_status' => [
233 'name' => 'status',
234 'type' => CRM_Utils_Type::T_STRING,
235 'title' => ts('Mailing Job Status'),
236 'description' => ts('The state of this job'),
237 'maxlength' => 12,
238 'size' => CRM_Utils_Type::TWELVE,
239 'where' => 'civicrm_mailing_job.status',
240 'table_name' => 'civicrm_mailing_job',
241 'entity' => 'MailingJob',
242 'bao' => 'CRM_Mailing_BAO_MailingJob',
243 'localizable' => 0,
244 'html' => [
245 'type' => 'Select',
246 ],
247 'pseudoconstant' => [
248 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus',
249 ],
250 'add' => NULL,
251 ],
252 'is_test' => [
253 'name' => 'is_test',
254 'type' => CRM_Utils_Type::T_BOOLEAN,
255 'title' => ts('Mailing Job Is Test?'),
256 'description' => ts('Is this job for a test mail?'),
257 'where' => 'civicrm_mailing_job.is_test',
258 'default' => '0',
259 'table_name' => 'civicrm_mailing_job',
260 'entity' => 'MailingJob',
261 'bao' => 'CRM_Mailing_BAO_MailingJob',
262 'localizable' => 0,
263 'add' => '1.9',
264 ],
265 'job_type' => [
266 'name' => 'job_type',
267 'type' => CRM_Utils_Type::T_STRING,
268 'title' => ts('Mailing Job Type'),
269 'description' => ts('Type of mailling job: null | child '),
270 'maxlength' => 255,
271 'size' => CRM_Utils_Type::HUGE,
272 'where' => 'civicrm_mailing_job.job_type',
273 'table_name' => 'civicrm_mailing_job',
274 'entity' => 'MailingJob',
275 'bao' => 'CRM_Mailing_BAO_MailingJob',
276 'localizable' => 0,
277 'add' => '3.3',
278 ],
279 'parent_id' => [
280 'name' => 'parent_id',
281 'type' => CRM_Utils_Type::T_INT,
282 'title' => ts('Mailing Job Parent'),
283 'description' => ts('Parent job id'),
284 'where' => 'civicrm_mailing_job.parent_id',
285 'default' => 'NULL',
286 'table_name' => 'civicrm_mailing_job',
287 'entity' => 'MailingJob',
288 'bao' => 'CRM_Mailing_BAO_MailingJob',
289 'localizable' => 0,
290 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
291 'add' => '3.3',
292 ],
293 'job_offset' => [
294 'name' => 'job_offset',
295 'type' => CRM_Utils_Type::T_INT,
296 'title' => ts('Mailing Job Offset'),
297 'description' => ts('Offset of the child job'),
298 'where' => 'civicrm_mailing_job.job_offset',
299 'default' => '0',
300 'table_name' => 'civicrm_mailing_job',
301 'entity' => 'MailingJob',
302 'bao' => 'CRM_Mailing_BAO_MailingJob',
303 'localizable' => 0,
304 'add' => '3.3',
305 ],
306 'job_limit' => [
307 'name' => 'job_limit',
308 'type' => CRM_Utils_Type::T_INT,
309 'title' => ts('Mailing Job Limit'),
310 'description' => ts('Queue size limit for each child job'),
311 'where' => 'civicrm_mailing_job.job_limit',
312 'default' => '0',
313 'table_name' => 'civicrm_mailing_job',
314 'entity' => 'MailingJob',
315 'bao' => 'CRM_Mailing_BAO_MailingJob',
316 'localizable' => 0,
317 'add' => '3.3',
318 ],
319 ];
320 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
321 }
322 return Civi::$statics[__CLASS__]['fields'];
323 }
324
325 /**
326 * Return a mapping from field-name to the corresponding key (as used in fields()).
327 *
328 * @return array
329 * Array(string $name => string $uniqueName).
330 */
331 public static function &fieldKeys() {
332 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
333 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
334 }
335 return Civi::$statics[__CLASS__]['fieldKeys'];
336 }
337
338 /**
339 * Returns the names of this table
340 *
341 * @return string
342 */
343 public static function getTableName() {
344 return self::$_tableName;
345 }
346
347 /**
348 * Returns if this table needs to be logged
349 *
350 * @return bool
351 */
352 public function getLog() {
353 return self::$_log;
354 }
355
356 /**
357 * Returns the list of fields that can be imported
358 *
359 * @param bool $prefix
360 *
361 * @return array
362 */
363 public static function &import($prefix = FALSE) {
364 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_job', $prefix, []);
365 return $r;
366 }
367
368 /**
369 * Returns the list of fields that can be exported
370 *
371 * @param bool $prefix
372 *
373 * @return array
374 */
375 public static function &export($prefix = FALSE) {
376 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_job', $prefix, []);
377 return $r;
378 }
379
380 /**
381 * Returns the list of indices
382 *
383 * @param bool $localize
384 *
385 * @return array
386 */
387 public static function indices($localize = TRUE) {
388 $indices = [];
389 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
390 }
391
392 }