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:16d3f472e9379145910fa49ef5d2576a)
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;
40 * The ID of the mailing this Job will send.
47 * date on which this job was scheduled.
51 public $scheduled_date;
54 * date on which this job was started.
61 * date on which this job ended.
68 * The state of this job
75 * Is this job for a test mail?
82 * Type of mailling job: null | child
96 * Offset of the child job
103 * Queue size limit for each child job
112 public function __construct() {
113 $this->__table
= 'civicrm_mailing_job';
114 parent
::__construct();
118 * Returns localized title of this entity.
120 * @param bool $plural
121 * Whether to return the plural version of the title.
123 public static function getEntityTitle($plural = FALSE) {
124 return $plural ?
ts('Mailing Jobs') : ts('Mailing Job');
128 * Returns foreign keys and entity references.
131 * [CRM_Core_Reference_Interface]
133 public static function getReferenceColumns() {
134 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
135 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
136 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
137 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'parent_id', 'civicrm_mailing_job', 'id');
138 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
140 return Civi
::$statics[__CLASS__
]['links'];
144 * Returns all the column names of this table
148 public static function &fields() {
149 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
150 Civi
::$statics[__CLASS__
]['fields'] = [
153 'type' => CRM_Utils_Type
::T_INT
,
154 'title' => ts('Mailing Job ID'),
156 'where' => 'civicrm_mailing_job.id',
157 'table_name' => 'civicrm_mailing_job',
158 'entity' => 'MailingJob',
159 'bao' => 'CRM_Mailing_BAO_MailingJob',
164 'name' => 'mailing_id',
165 'type' => CRM_Utils_Type
::T_INT
,
166 'title' => ts('Mailing'),
167 'description' => ts('The ID of the mailing this Job will send.'),
169 'where' => 'civicrm_mailing_job.mailing_id',
170 'table_name' => 'civicrm_mailing_job',
171 'entity' => 'MailingJob',
172 'bao' => 'CRM_Mailing_BAO_MailingJob',
174 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
177 'scheduled_date' => [
178 'name' => 'scheduled_date',
179 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
180 'title' => ts('Mailing Scheduled Date'),
181 'description' => ts('date on which this job was scheduled.'),
183 'where' => 'civicrm_mailing_job.scheduled_date',
185 'table_name' => 'civicrm_mailing_job',
186 'entity' => 'MailingJob',
187 'bao' => 'CRM_Mailing_BAO_MailingJob',
190 'type' => 'Select Date',
191 'formatType' => 'activityDateTime',
195 'mailing_job_start_date' => [
196 'name' => 'start_date',
197 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
198 'title' => ts('Mailing Job Start Date'),
199 'description' => ts('date on which this job was started.'),
201 'where' => 'civicrm_mailing_job.start_date',
203 'table_name' => 'civicrm_mailing_job',
204 'entity' => 'MailingJob',
205 'bao' => 'CRM_Mailing_BAO_MailingJob',
207 'unique_title' => ts('Mailing Start Date'),
209 'type' => 'Select Date',
210 'formatType' => 'activityDateTime',
215 'name' => 'end_date',
216 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
217 'title' => ts('Mailing Job End Date'),
218 'description' => ts('date on which this job ended.'),
220 'where' => 'civicrm_mailing_job.end_date',
222 'table_name' => 'civicrm_mailing_job',
223 'entity' => 'MailingJob',
224 'bao' => 'CRM_Mailing_BAO_MailingJob',
227 'type' => 'Select Date',
228 'formatType' => 'activityDateTime',
232 'mailing_job_status' => [
234 'type' => CRM_Utils_Type
::T_STRING
,
235 'title' => ts('Mailing Job Status'),
236 'description' => ts('The state of this job'),
238 'size' => CRM_Utils_Type
::TWELVE
,
239 'where' => 'civicrm_mailing_job.status',
240 'table_name' => 'civicrm_mailing_job',
241 'entity' => 'MailingJob',
242 'bao' => 'CRM_Mailing_BAO_MailingJob',
247 'pseudoconstant' => [
248 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus',
254 'type' => CRM_Utils_Type
::T_BOOLEAN
,
255 'title' => ts('Mailing Job Is Test?'),
256 'description' => ts('Is this job for a test mail?'),
257 'where' => 'civicrm_mailing_job.is_test',
259 'table_name' => 'civicrm_mailing_job',
260 'entity' => 'MailingJob',
261 'bao' => 'CRM_Mailing_BAO_MailingJob',
266 'name' => 'job_type',
267 'type' => CRM_Utils_Type
::T_STRING
,
268 'title' => ts('Mailing Job Type'),
269 'description' => ts('Type of mailling job: null | child '),
271 'size' => CRM_Utils_Type
::HUGE
,
272 'where' => 'civicrm_mailing_job.job_type',
273 'table_name' => 'civicrm_mailing_job',
274 'entity' => 'MailingJob',
275 'bao' => 'CRM_Mailing_BAO_MailingJob',
280 'name' => 'parent_id',
281 'type' => CRM_Utils_Type
::T_INT
,
282 'title' => ts('Mailing Job Parent'),
283 'description' => ts('Parent job id'),
284 'where' => 'civicrm_mailing_job.parent_id',
286 'table_name' => 'civicrm_mailing_job',
287 'entity' => 'MailingJob',
288 'bao' => 'CRM_Mailing_BAO_MailingJob',
290 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
294 'name' => 'job_offset',
295 'type' => CRM_Utils_Type
::T_INT
,
296 'title' => ts('Mailing Job Offset'),
297 'description' => ts('Offset of the child job'),
298 'where' => 'civicrm_mailing_job.job_offset',
300 'table_name' => 'civicrm_mailing_job',
301 'entity' => 'MailingJob',
302 'bao' => 'CRM_Mailing_BAO_MailingJob',
307 'name' => 'job_limit',
308 'type' => CRM_Utils_Type
::T_INT
,
309 'title' => ts('Mailing Job Limit'),
310 'description' => ts('Queue size limit for each child job'),
311 'where' => 'civicrm_mailing_job.job_limit',
313 'table_name' => 'civicrm_mailing_job',
314 'entity' => 'MailingJob',
315 'bao' => 'CRM_Mailing_BAO_MailingJob',
320 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
322 return Civi
::$statics[__CLASS__
]['fields'];
326 * Return a mapping from field-name to the corresponding key (as used in fields()).
329 * Array(string $name => string $uniqueName).
331 public static function &fieldKeys() {
332 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
333 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
335 return Civi
::$statics[__CLASS__
]['fieldKeys'];
339 * Returns the names of this table
343 public static function getTableName() {
344 return self
::$_tableName;
348 * Returns if this table needs to be logged
352 public function getLog() {
357 * Returns the list of fields that can be imported
359 * @param bool $prefix
363 public static function &import($prefix = FALSE) {
364 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_job', $prefix, []);
369 * Returns the list of fields that can be exported
371 * @param bool $prefix
375 public static function &export($prefix = FALSE) {
376 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_job', $prefix, []);
381 * Returns the list of indices
383 * @param bool $localize
387 public static function indices($localize = TRUE) {
389 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;