Merge pull request #11366 from mattwire/CRM-21512_remove_restriction_update_subscript...
[civicrm-core.git] / CRM / Mailing / DAO / MailingJob.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2017
6 *
7 * Generated from xml/schema/CRM/Mailing/MailingJob.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:51449e1b36d9d248712f346f20c9e446)
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 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 static $_log = FALSE;
30
31 /**
32 * @var int unsigned
33 */
34 public $id;
35
36 /**
37 * The ID of the mailing this Job will send.
38 *
39 * @var int unsigned
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 boolean
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 unsigned
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 foreign keys and entity references.
116 *
117 * @return array
118 * [CRM_Core_Reference_Interface]
119 */
120 public static function getReferenceColumns() {
121 if (!isset(Civi::$statics[__CLASS__]['links'])) {
122 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
123 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
124 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_mailing_job', 'id');
125 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
126 }
127 return Civi::$statics[__CLASS__]['links'];
128 }
129
130 /**
131 * Returns all the column names of this table
132 *
133 * @return array
134 */
135 public static function &fields() {
136 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
137 Civi::$statics[__CLASS__]['fields'] = [
138 'id' => [
139 'name' => 'id',
140 'type' => CRM_Utils_Type::T_INT,
141 'title' => ts('Mailing Job ID'),
142 'required' => TRUE,
143 'table_name' => 'civicrm_mailing_job',
144 'entity' => 'MailingJob',
145 'bao' => 'CRM_Mailing_BAO_MailingJob',
146 'localizable' => 0,
147 ],
148 'mailing_id' => [
149 'name' => 'mailing_id',
150 'type' => CRM_Utils_Type::T_INT,
151 'title' => ts('Mailing'),
152 'description' => 'The ID of the mailing this Job will send.',
153 'required' => TRUE,
154 'table_name' => 'civicrm_mailing_job',
155 'entity' => 'MailingJob',
156 'bao' => 'CRM_Mailing_BAO_MailingJob',
157 'localizable' => 0,
158 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
159 ],
160 'scheduled_date' => [
161 'name' => 'scheduled_date',
162 'type' => CRM_Utils_Type::T_TIMESTAMP,
163 'title' => ts('Mailing Scheduled Date'),
164 'description' => 'date on which this job was scheduled.',
165 'required' => FALSE,
166 'default' => 'NULL',
167 'table_name' => 'civicrm_mailing_job',
168 'entity' => 'MailingJob',
169 'bao' => 'CRM_Mailing_BAO_MailingJob',
170 'localizable' => 0,
171 ],
172 'start_date' => [
173 'name' => 'start_date',
174 'type' => CRM_Utils_Type::T_TIMESTAMP,
175 'title' => ts('Mailing Job Start Date'),
176 'description' => 'date on which this job was started.',
177 'required' => FALSE,
178 'default' => 'NULL',
179 'table_name' => 'civicrm_mailing_job',
180 'entity' => 'MailingJob',
181 'bao' => 'CRM_Mailing_BAO_MailingJob',
182 'localizable' => 0,
183 ],
184 'end_date' => [
185 'name' => 'end_date',
186 'type' => CRM_Utils_Type::T_TIMESTAMP,
187 'title' => ts('Mailing Job End Date'),
188 'description' => 'date on which this job ended.',
189 'required' => FALSE,
190 'default' => 'NULL',
191 'table_name' => 'civicrm_mailing_job',
192 'entity' => 'MailingJob',
193 'bao' => 'CRM_Mailing_BAO_MailingJob',
194 'localizable' => 0,
195 ],
196 'status' => [
197 'name' => 'status',
198 'type' => CRM_Utils_Type::T_STRING,
199 'title' => ts('Mailing Job Status'),
200 'description' => 'The state of this job',
201 'maxlength' => 12,
202 'size' => CRM_Utils_Type::TWELVE,
203 'table_name' => 'civicrm_mailing_job',
204 'entity' => 'MailingJob',
205 'bao' => 'CRM_Mailing_BAO_MailingJob',
206 'localizable' => 0,
207 'html' => [
208 'type' => 'Select',
209 ],
210 'pseudoconstant' => [
211 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus',
212 ]
213 ],
214 'is_test' => [
215 'name' => 'is_test',
216 'type' => CRM_Utils_Type::T_BOOLEAN,
217 'title' => ts('Mailing Job Is Test?'),
218 'description' => 'Is this job for a test mail?',
219 'table_name' => 'civicrm_mailing_job',
220 'entity' => 'MailingJob',
221 'bao' => 'CRM_Mailing_BAO_MailingJob',
222 'localizable' => 0,
223 ],
224 'job_type' => [
225 'name' => 'job_type',
226 'type' => CRM_Utils_Type::T_STRING,
227 'title' => ts('Mailing Job Type'),
228 'description' => 'Type of mailling job: null | child ',
229 'maxlength' => 255,
230 'size' => CRM_Utils_Type::HUGE,
231 'table_name' => 'civicrm_mailing_job',
232 'entity' => 'MailingJob',
233 'bao' => 'CRM_Mailing_BAO_MailingJob',
234 'localizable' => 0,
235 ],
236 'parent_id' => [
237 'name' => 'parent_id',
238 'type' => CRM_Utils_Type::T_INT,
239 'title' => ts('Mailing Job Parent'),
240 'description' => 'Parent job id',
241 'default' => 'NULL',
242 'table_name' => 'civicrm_mailing_job',
243 'entity' => 'MailingJob',
244 'bao' => 'CRM_Mailing_BAO_MailingJob',
245 'localizable' => 0,
246 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
247 ],
248 'job_offset' => [
249 'name' => 'job_offset',
250 'type' => CRM_Utils_Type::T_INT,
251 'title' => ts('Mailing Job Offset'),
252 'description' => 'Offset of the child job',
253 'table_name' => 'civicrm_mailing_job',
254 'entity' => 'MailingJob',
255 'bao' => 'CRM_Mailing_BAO_MailingJob',
256 'localizable' => 0,
257 ],
258 'job_limit' => [
259 'name' => 'job_limit',
260 'type' => CRM_Utils_Type::T_INT,
261 'title' => ts('Mailing Job Limit'),
262 'description' => 'Queue size limit for each child job',
263 'table_name' => 'civicrm_mailing_job',
264 'entity' => 'MailingJob',
265 'bao' => 'CRM_Mailing_BAO_MailingJob',
266 'localizable' => 0,
267 ],
268 ];
269 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
270 }
271 return Civi::$statics[__CLASS__]['fields'];
272 }
273
274 /**
275 * Return a mapping from field-name to the corresponding key (as used in fields()).
276 *
277 * @return array
278 * Array(string $name => string $uniqueName).
279 */
280 public static function &fieldKeys() {
281 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
282 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
283 }
284 return Civi::$statics[__CLASS__]['fieldKeys'];
285 }
286
287 /**
288 * Returns the names of this table
289 *
290 * @return string
291 */
292 public static function getTableName() {
293 return self::$_tableName;
294 }
295
296 /**
297 * Returns if this table needs to be logged
298 *
299 * @return bool
300 */
301 public function getLog() {
302 return self::$_log;
303 }
304
305 /**
306 * Returns the list of fields that can be imported
307 *
308 * @param bool $prefix
309 *
310 * @return array
311 */
312 public static function &import($prefix = FALSE) {
313 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_job', $prefix, []);
314 return $r;
315 }
316
317 /**
318 * Returns the list of fields that can be exported
319 *
320 * @param bool $prefix
321 *
322 * @return array
323 */
324 public static function &export($prefix = FALSE) {
325 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_job', $prefix, []);
326 return $r;
327 }
328
329 /**
330 * Returns the list of indices
331 *
332 * @param bool $localize
333 *
334 * @return array
335 */
336 public static function indices($localize = TRUE) {
337 $indices = [];
338 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
339 }
340
341 }