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