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:492e51f255632b9c3d87714bc9ca0f4d)
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?
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?'),
287 'where' => 'civicrm_mailing_job.is_test',
289 'table_name' => 'civicrm_mailing_job',
290 'entity' => 'MailingJob',
291 'bao' => 'CRM_Mailing_BAO_MailingJob',
296 'name' => 'job_type',
297 'type' => CRM_Utils_Type
::T_STRING
,
298 'title' => ts('Mailing Job Type'),
299 'description' => ts('Type of mailling job: null | child '),
301 'size' => CRM_Utils_Type
::HUGE
,
302 'where' => 'civicrm_mailing_job.job_type',
303 'table_name' => 'civicrm_mailing_job',
304 'entity' => 'MailingJob',
305 'bao' => 'CRM_Mailing_BAO_MailingJob',
310 'name' => 'parent_id',
311 'type' => CRM_Utils_Type
::T_INT
,
312 'title' => ts('Parent ID'),
313 'description' => ts('Parent job id'),
314 'where' => 'civicrm_mailing_job.parent_id',
316 'table_name' => 'civicrm_mailing_job',
317 'entity' => 'MailingJob',
318 'bao' => 'CRM_Mailing_BAO_MailingJob',
320 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
322 'label' => ts("Parent"),
327 'name' => 'job_offset',
328 'type' => CRM_Utils_Type
::T_INT
,
329 'title' => ts('Mailing Job Offset'),
330 'description' => ts('Offset of the child job'),
331 'where' => 'civicrm_mailing_job.job_offset',
333 'table_name' => 'civicrm_mailing_job',
334 'entity' => 'MailingJob',
335 'bao' => 'CRM_Mailing_BAO_MailingJob',
340 'name' => 'job_limit',
341 'type' => CRM_Utils_Type
::T_INT
,
342 'title' => ts('Mailing Job Limit'),
343 'description' => ts('Queue size limit for each child job'),
344 'where' => 'civicrm_mailing_job.job_limit',
346 'table_name' => 'civicrm_mailing_job',
347 'entity' => 'MailingJob',
348 'bao' => 'CRM_Mailing_BAO_MailingJob',
353 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
355 return Civi
::$statics[__CLASS__
]['fields'];
359 * Return a mapping from field-name to the corresponding key (as used in fields()).
362 * Array(string $name => string $uniqueName).
364 public static function &fieldKeys() {
365 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
366 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
368 return Civi
::$statics[__CLASS__
]['fieldKeys'];
372 * Returns the names of this table
376 public static function getTableName() {
377 return self
::$_tableName;
381 * Returns if this table needs to be logged
385 public function getLog() {
390 * Returns the list of fields that can be imported
392 * @param bool $prefix
396 public static function &import($prefix = FALSE) {
397 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_job', $prefix, []);
402 * Returns the list of fields that can be exported
404 * @param bool $prefix
408 public static function &export($prefix = FALSE) {
409 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_job', $prefix, []);
414 * Returns the list of indices
416 * @param bool $localize
420 public static function indices($localize = TRUE) {
422 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;