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