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:2527bca832d0e7751c69a42d33f28159)
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',
168 'name' => 'mailing_id',
169 'type' => CRM_Utils_Type
::T_INT
,
170 'title' => ts('Mailing ID'),
171 'description' => ts('The ID of the mailing this Job will send.'),
173 'where' => 'civicrm_mailing_job.mailing_id',
174 'table_name' => 'civicrm_mailing_job',
175 'entity' => 'MailingJob',
176 'bao' => 'CRM_Mailing_BAO_MailingJob',
178 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
180 'label' => ts("Mailing"),
184 'scheduled_date' => [
185 'name' => 'scheduled_date',
186 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
187 'title' => ts('Mailing Scheduled Date'),
188 'description' => ts('date on which this job was scheduled.'),
190 'where' => 'civicrm_mailing_job.scheduled_date',
192 'table_name' => 'civicrm_mailing_job',
193 'entity' => 'MailingJob',
194 'bao' => 'CRM_Mailing_BAO_MailingJob',
197 'type' => 'Select Date',
198 'formatType' => 'activityDateTime',
202 'mailing_job_start_date' => [
203 'name' => 'start_date',
204 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
205 'title' => ts('Mailing Job Start Date'),
206 'description' => ts('date on which this job was started.'),
208 'where' => 'civicrm_mailing_job.start_date',
210 'table_name' => 'civicrm_mailing_job',
211 'entity' => 'MailingJob',
212 'bao' => 'CRM_Mailing_BAO_MailingJob',
214 'unique_title' => ts('Mailing Start Date'),
216 'type' => 'Select Date',
217 'formatType' => 'activityDateTime',
222 'name' => 'end_date',
223 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
224 'title' => ts('Mailing Job End Date'),
225 'description' => ts('date on which this job ended.'),
227 'where' => 'civicrm_mailing_job.end_date',
229 'table_name' => 'civicrm_mailing_job',
230 'entity' => 'MailingJob',
231 'bao' => 'CRM_Mailing_BAO_MailingJob',
234 'type' => 'Select Date',
235 'formatType' => 'activityDateTime',
239 'mailing_job_status' => [
241 'type' => CRM_Utils_Type
::T_STRING
,
242 'title' => ts('Mailing Job Status'),
243 'description' => ts('The state of this job'),
245 'size' => CRM_Utils_Type
::TWELVE
,
246 'where' => 'civicrm_mailing_job.status',
247 'table_name' => 'civicrm_mailing_job',
248 'entity' => 'MailingJob',
249 'bao' => 'CRM_Mailing_BAO_MailingJob',
254 'pseudoconstant' => [
255 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus',
261 'type' => CRM_Utils_Type
::T_BOOLEAN
,
262 'title' => ts('Mailing Job Is Test?'),
263 'description' => ts('Is this job for a test mail?'),
264 'where' => 'civicrm_mailing_job.is_test',
266 'table_name' => 'civicrm_mailing_job',
267 'entity' => 'MailingJob',
268 'bao' => 'CRM_Mailing_BAO_MailingJob',
273 'name' => 'job_type',
274 'type' => CRM_Utils_Type
::T_STRING
,
275 'title' => ts('Mailing Job Type'),
276 'description' => ts('Type of mailling job: null | child '),
278 'size' => CRM_Utils_Type
::HUGE
,
279 'where' => 'civicrm_mailing_job.job_type',
280 'table_name' => 'civicrm_mailing_job',
281 'entity' => 'MailingJob',
282 'bao' => 'CRM_Mailing_BAO_MailingJob',
287 'name' => 'parent_id',
288 'type' => CRM_Utils_Type
::T_INT
,
289 'title' => ts('Parent ID'),
290 'description' => ts('Parent job id'),
291 'where' => 'civicrm_mailing_job.parent_id',
293 'table_name' => 'civicrm_mailing_job',
294 'entity' => 'MailingJob',
295 'bao' => 'CRM_Mailing_BAO_MailingJob',
297 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
299 'label' => ts("Parent"),
304 'name' => 'job_offset',
305 'type' => CRM_Utils_Type
::T_INT
,
306 'title' => ts('Mailing Job Offset'),
307 'description' => ts('Offset of the child job'),
308 'where' => 'civicrm_mailing_job.job_offset',
310 'table_name' => 'civicrm_mailing_job',
311 'entity' => 'MailingJob',
312 'bao' => 'CRM_Mailing_BAO_MailingJob',
317 'name' => 'job_limit',
318 'type' => CRM_Utils_Type
::T_INT
,
319 'title' => ts('Mailing Job Limit'),
320 'description' => ts('Queue size limit for each child job'),
321 'where' => 'civicrm_mailing_job.job_limit',
323 'table_name' => 'civicrm_mailing_job',
324 'entity' => 'MailingJob',
325 'bao' => 'CRM_Mailing_BAO_MailingJob',
330 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
332 return Civi
::$statics[__CLASS__
]['fields'];
336 * Return a mapping from field-name to the corresponding key (as used in fields()).
339 * Array(string $name => string $uniqueName).
341 public static function &fieldKeys() {
342 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
343 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
345 return Civi
::$statics[__CLASS__
]['fieldKeys'];
349 * Returns the names of this table
353 public static function getTableName() {
354 return self
::$_tableName;
358 * Returns if this table needs to be logged
362 public function getLog() {
367 * Returns the list of fields that can be imported
369 * @param bool $prefix
373 public static function &import($prefix = FALSE) {
374 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_job', $prefix, []);
379 * Returns the list of fields that can be exported
381 * @param bool $prefix
385 public static function &export($prefix = FALSE) {
386 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_job', $prefix, []);
391 * Returns the list of indices
393 * @param bool $localize
397 public static function indices($localize = TRUE) {
399 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;