5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Mailing/MailingJob.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:fdca7fda2701c59049924abfdb6adf3b)
13 * Database access object for the MailingJob entity.
15 class CRM_Mailing_DAO_MailingJob
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '';
18 const COMPONENT
= 'CiviMail';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_mailing_job';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
42 * The ID of the mailing this Job will send.
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
51 * date on which this job was scheduled.
54 * (SQL type: timestamp)
55 * Note that values will be retrieved from the database as a string.
57 public $scheduled_date;
60 * date on which this job was started.
63 * (SQL type: timestamp)
64 * Note that values will be retrieved from the database as a string.
69 * date on which this job ended.
72 * (SQL type: timestamp)
73 * Note that values will be retrieved from the database as a string.
78 * The state of this job
81 * (SQL type: varchar(12))
82 * Note that values will be retrieved from the database as a string.
87 * Is this job for a test mail?
89 * @var bool|string|null
91 * Note that values will be retrieved from the database as a string.
96 * Type of mailling job: null | child
99 * (SQL type: varchar(255))
100 * Note that values will be retrieved from the database as a string.
107 * @var int|string|null
108 * (SQL type: int unsigned)
109 * Note that values will be retrieved from the database as a string.
114 * Offset of the child job
116 * @var int|string|null
118 * Note that values will be retrieved from the database as a string.
123 * Queue size limit for each child job
125 * @var int|string|null
127 * Note that values will be retrieved from the database as a string.
134 public function __construct() {
135 $this->__table
= 'civicrm_mailing_job';
136 parent
::__construct();
140 * Returns localized title of this entity.
142 * @param bool $plural
143 * Whether to return the plural version of the title.
145 public static function getEntityTitle($plural = FALSE) {
146 return $plural ?
ts('Mailing Jobs') : ts('Mailing Job');
150 * Returns foreign keys and entity references.
153 * [CRM_Core_Reference_Interface]
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']);
162 return Civi
::$statics[__CLASS__
]['links'];
166 * Returns all the column names of this table
170 public static function &fields() {
171 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
172 Civi
::$statics[__CLASS__
]['fields'] = [
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Mailing Job ID'),
178 'where' => 'civicrm_mailing_job.id',
179 'table_name' => 'civicrm_mailing_job',
180 'entity' => 'MailingJob',
181 'bao' => 'CRM_Mailing_BAO_MailingJob',
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.'),
195 'where' => 'civicrm_mailing_job.mailing_id',
196 'table_name' => 'civicrm_mailing_job',
197 'entity' => 'MailingJob',
198 'bao' => 'CRM_Mailing_BAO_MailingJob',
200 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
202 'label' => ts("Mailing"),
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.'),
212 'where' => 'civicrm_mailing_job.scheduled_date',
214 'table_name' => 'civicrm_mailing_job',
215 'entity' => 'MailingJob',
216 'bao' => 'CRM_Mailing_BAO_MailingJob',
219 'type' => 'Select Date',
220 'formatType' => 'activityDateTime',
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.'),
230 'where' => 'civicrm_mailing_job.start_date',
232 'table_name' => 'civicrm_mailing_job',
233 'entity' => 'MailingJob',
234 'bao' => 'CRM_Mailing_BAO_MailingJob',
236 'unique_title' => ts('Mailing Start Date'),
238 'type' => 'Select Date',
239 'formatType' => 'activityDateTime',
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.'),
249 'where' => 'civicrm_mailing_job.end_date',
251 'table_name' => 'civicrm_mailing_job',
252 'entity' => 'MailingJob',
253 'bao' => 'CRM_Mailing_BAO_MailingJob',
256 'type' => 'Select Date',
257 'formatType' => 'activityDateTime',
261 'mailing_job_status' => [
263 'type' => CRM_Utils_Type
::T_STRING
,
264 'title' => ts('Mailing Job Status'),
265 'description' => ts('The state of this job'),
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',
276 'pseudoconstant' => [
277 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus',
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',
288 'table_name' => 'civicrm_mailing_job',
289 'entity' => 'MailingJob',
290 'bao' => 'CRM_Mailing_BAO_MailingJob',
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 '),
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',
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',
315 'table_name' => 'civicrm_mailing_job',
316 'entity' => 'MailingJob',
317 'bao' => 'CRM_Mailing_BAO_MailingJob',
319 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
321 'label' => ts("Parent"),
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',
332 'table_name' => 'civicrm_mailing_job',
333 'entity' => 'MailingJob',
334 'bao' => 'CRM_Mailing_BAO_MailingJob',
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',
345 'table_name' => 'civicrm_mailing_job',
346 'entity' => 'MailingJob',
347 'bao' => 'CRM_Mailing_BAO_MailingJob',
352 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
354 return Civi
::$statics[__CLASS__
]['fields'];
358 * Return a mapping from field-name to the corresponding key (as used in fields()).
361 * Array(string $name => string $uniqueName).
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()));
367 return Civi
::$statics[__CLASS__
]['fieldKeys'];
371 * Returns the names of this table
375 public static function getTableName() {
376 return self
::$_tableName;
380 * Returns if this table needs to be logged
384 public function getLog() {
389 * Returns the list of fields that can be imported
391 * @param bool $prefix
395 public static function &import($prefix = FALSE) {
396 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_job', $prefix, []);
401 * Returns the list of fields that can be exported
403 * @param bool $prefix
407 public static function &export($prefix = FALSE) {
408 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_job', $prefix, []);
413 * Returns the list of indices
415 * @param bool $localize
419 public static function indices($localize = TRUE) {
421 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;