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