Merge pull request #8769 from totten/master-gencode-test
[civicrm-core.git] / CRM / Mailing / DAO / MailingJob.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Mailing/MailingJob.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:df7f5d74b6be9d995c7990e4315bfe40)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_mailing_job';
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = false;
51 /**
52 *
53 * @var int unsigned
54 */
55 public $id;
56 /**
57 * The ID of the mailing this Job will send.
58 *
59 * @var int unsigned
60 */
61 public $mailing_id;
62 /**
63 * date on which this job was scheduled.
64 *
65 * @var datetime
66 */
67 public $scheduled_date;
68 /**
69 * date on which this job was started.
70 *
71 * @var datetime
72 */
73 public $start_date;
74 /**
75 * date on which this job ended.
76 *
77 * @var datetime
78 */
79 public $end_date;
80 /**
81 * The state of this job
82 *
83 * @var string
84 */
85 public $status;
86 /**
87 * Is this job for a test mail?
88 *
89 * @var boolean
90 */
91 public $is_test;
92 /**
93 * Type of mailling job: null | child
94 *
95 * @var string
96 */
97 public $job_type;
98 /**
99 * Parent job id
100 *
101 * @var int unsigned
102 */
103 public $parent_id;
104 /**
105 * Offset of the child job
106 *
107 * @var int
108 */
109 public $job_offset;
110 /**
111 * Queue size limit for each child job
112 *
113 * @var int
114 */
115 public $job_limit;
116 /**
117 * class constructor
118 *
119 * @return civicrm_mailing_job
120 */
121 function __construct() {
122 $this->__table = 'civicrm_mailing_job';
123 parent::__construct();
124 }
125 /**
126 * Returns foreign keys and entity references
127 *
128 * @return array
129 * [CRM_Core_Reference_Interface]
130 */
131 static function getReferenceColumns() {
132 if (!isset(Civi::$statics[__CLASS__]['links'])) {
133 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
134 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'mailing_id', 'civicrm_mailing', 'id');
135 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_mailing_job', 'id');
136 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
137 }
138 return Civi::$statics[__CLASS__]['links'];
139 }
140 /**
141 * Returns all the column names of this table
142 *
143 * @return array
144 */
145 static function &fields() {
146 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
147 Civi::$statics[__CLASS__]['fields'] = array(
148 'id' => array(
149 'name' => 'id',
150 'type' => CRM_Utils_Type::T_INT,
151 'title' => ts('Mailing Job ID') ,
152 'required' => true,
153 ) ,
154 'mailing_id' => array(
155 'name' => 'mailing_id',
156 'type' => CRM_Utils_Type::T_INT,
157 'title' => ts('Mailing') ,
158 'description' => 'The ID of the mailing this Job will send.',
159 'required' => true,
160 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
161 ) ,
162 'scheduled_date' => array(
163 'name' => 'scheduled_date',
164 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
165 'title' => ts('Mailing Scheduled Date') ,
166 'description' => 'date on which this job was scheduled.',
167 ) ,
168 'start_date' => array(
169 'name' => 'start_date',
170 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
171 'title' => ts('Mailing Job Start Date') ,
172 'description' => 'date on which this job was started.',
173 ) ,
174 'end_date' => array(
175 'name' => 'end_date',
176 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
177 'title' => ts('Mailing Job End Date') ,
178 'description' => 'date on which this job ended.',
179 ) ,
180 'status' => array(
181 'name' => 'status',
182 'type' => CRM_Utils_Type::T_STRING,
183 'title' => ts('Mailing Job Status') ,
184 'description' => 'The state of this job',
185 'maxlength' => 12,
186 'size' => CRM_Utils_Type::TWELVE,
187 'html' => array(
188 'type' => 'Select',
189 ) ,
190 'pseudoconstant' => array(
191 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus',
192 )
193 ) ,
194 'is_test' => array(
195 'name' => 'is_test',
196 'type' => CRM_Utils_Type::T_BOOLEAN,
197 'title' => ts('Mailing Job Is Test?') ,
198 'description' => 'Is this job for a test mail?',
199 ) ,
200 'job_type' => array(
201 'name' => 'job_type',
202 'type' => CRM_Utils_Type::T_STRING,
203 'title' => ts('Mailing Job Type') ,
204 'description' => 'Type of mailling job: null | child ',
205 'maxlength' => 255,
206 'size' => CRM_Utils_Type::HUGE,
207 ) ,
208 'parent_id' => array(
209 'name' => 'parent_id',
210 'type' => CRM_Utils_Type::T_INT,
211 'title' => ts('Mailing Job Parent') ,
212 'description' => 'Parent job id',
213 'default' => 'NULL',
214 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
215 ) ,
216 'job_offset' => array(
217 'name' => 'job_offset',
218 'type' => CRM_Utils_Type::T_INT,
219 'title' => ts('Mailing Job Offset') ,
220 'description' => 'Offset of the child job',
221 ) ,
222 'job_limit' => array(
223 'name' => 'job_limit',
224 'type' => CRM_Utils_Type::T_INT,
225 'title' => ts('Mailing Job Limit') ,
226 'description' => 'Queue size limit for each child job',
227 ) ,
228 );
229 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
230 }
231 return Civi::$statics[__CLASS__]['fields'];
232 }
233 /**
234 * Return a mapping from field-name to the corresponding key (as used in fields()).
235 *
236 * @return array
237 * Array(string $name => string $uniqueName).
238 */
239 static function &fieldKeys() {
240 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
241 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
242 }
243 return Civi::$statics[__CLASS__]['fieldKeys'];
244 }
245 /**
246 * Returns the names of this table
247 *
248 * @return string
249 */
250 static function getTableName() {
251 return self::$_tableName;
252 }
253 /**
254 * Returns if this table needs to be logged
255 *
256 * @return boolean
257 */
258 function getLog() {
259 return self::$_log;
260 }
261 /**
262 * Returns the list of fields that can be imported
263 *
264 * @param bool $prefix
265 *
266 * @return array
267 */
268 static function &import($prefix = false) {
269 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_job', $prefix, array());
270 return $r;
271 }
272 /**
273 * Returns the list of fields that can be exported
274 *
275 * @param bool $prefix
276 *
277 * @return array
278 */
279 static function &export($prefix = false) {
280 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_job', $prefix, array());
281 return $r;
282 }
283 }