Merge pull request #23561 from eileenmcnaughton/import_catcher_
[civicrm-core.git] / CRM / Mailing / DAO / Spool.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Mailing/Spool.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:be1b386bf2b06844863726171878fb37)
10 */
11
12 /**
13 * Database access object for the Spool entity.
14 */
15 class CRM_Mailing_DAO_Spool extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
18 const COMPONENT = 'CiviMail';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_mailing_spool';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = FALSE;
33
34 /**
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
38 */
39 public $id;
40
41 /**
42 * The ID of the Job .
43 *
44 * @var int|string
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
47 */
48 public $job_id;
49
50 /**
51 * The email of the recipients this mail is to be sent.
52 *
53 * @var string|null
54 * (SQL type: text)
55 * Note that values will be retrieved from the database as a string.
56 */
57 public $recipient_email;
58
59 /**
60 * The header information of this mailing .
61 *
62 * @var string|null
63 * (SQL type: text)
64 * Note that values will be retrieved from the database as a string.
65 */
66 public $headers;
67
68 /**
69 * The body of this mailing.
70 *
71 * @var string|null
72 * (SQL type: text)
73 * Note that values will be retrieved from the database as a string.
74 */
75 public $body;
76
77 /**
78 * date on which this job was added.
79 *
80 * @var string
81 * (SQL type: timestamp)
82 * Note that values will be retrieved from the database as a string.
83 */
84 public $added_at;
85
86 /**
87 * date on which this job was removed.
88 *
89 * @var string
90 * (SQL type: timestamp)
91 * Note that values will be retrieved from the database as a string.
92 */
93 public $removed_at;
94
95 /**
96 * Class constructor.
97 */
98 public function __construct() {
99 $this->__table = 'civicrm_mailing_spool';
100 parent::__construct();
101 }
102
103 /**
104 * Returns localized title of this entity.
105 *
106 * @param bool $plural
107 * Whether to return the plural version of the title.
108 */
109 public static function getEntityTitle($plural = FALSE) {
110 return $plural ? ts('Spools') : ts('Spool');
111 }
112
113 /**
114 * Returns foreign keys and entity references.
115 *
116 * @return array
117 * [CRM_Core_Reference_Interface]
118 */
119 public static function getReferenceColumns() {
120 if (!isset(Civi::$statics[__CLASS__]['links'])) {
121 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
122 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'job_id', 'civicrm_mailing_job', 'id');
123 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
124 }
125 return Civi::$statics[__CLASS__]['links'];
126 }
127
128 /**
129 * Returns all the column names of this table
130 *
131 * @return array
132 */
133 public static function &fields() {
134 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
135 Civi::$statics[__CLASS__]['fields'] = [
136 'id' => [
137 'name' => 'id',
138 'type' => CRM_Utils_Type::T_INT,
139 'title' => ts('Spool ID'),
140 'required' => TRUE,
141 'where' => 'civicrm_mailing_spool.id',
142 'table_name' => 'civicrm_mailing_spool',
143 'entity' => 'Spool',
144 'bao' => 'CRM_Mailing_BAO_Spool',
145 'localizable' => 0,
146 'html' => [
147 'type' => 'Number',
148 ],
149 'readonly' => TRUE,
150 'add' => NULL,
151 ],
152 'job_id' => [
153 'name' => 'job_id',
154 'type' => CRM_Utils_Type::T_INT,
155 'title' => ts('Job ID'),
156 'description' => ts('The ID of the Job .'),
157 'required' => TRUE,
158 'where' => 'civicrm_mailing_spool.job_id',
159 'table_name' => 'civicrm_mailing_spool',
160 'entity' => 'Spool',
161 'bao' => 'CRM_Mailing_BAO_Spool',
162 'localizable' => 0,
163 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
164 'html' => [
165 'label' => ts("Job"),
166 ],
167 'add' => NULL,
168 ],
169 'recipient_email' => [
170 'name' => 'recipient_email',
171 'type' => CRM_Utils_Type::T_TEXT,
172 'title' => ts('Recipient Email'),
173 'description' => ts('The email of the recipients this mail is to be sent.'),
174 'where' => 'civicrm_mailing_spool.recipient_email',
175 'table_name' => 'civicrm_mailing_spool',
176 'entity' => 'Spool',
177 'bao' => 'CRM_Mailing_BAO_Spool',
178 'localizable' => 0,
179 'add' => NULL,
180 ],
181 'headers' => [
182 'name' => 'headers',
183 'type' => CRM_Utils_Type::T_TEXT,
184 'title' => ts('Headers'),
185 'description' => ts('The header information of this mailing .'),
186 'where' => 'civicrm_mailing_spool.headers',
187 'table_name' => 'civicrm_mailing_spool',
188 'entity' => 'Spool',
189 'bao' => 'CRM_Mailing_BAO_Spool',
190 'localizable' => 0,
191 'add' => NULL,
192 ],
193 'body' => [
194 'name' => 'body',
195 'type' => CRM_Utils_Type::T_TEXT,
196 'title' => ts('Body'),
197 'description' => ts('The body of this mailing.'),
198 'where' => 'civicrm_mailing_spool.body',
199 'table_name' => 'civicrm_mailing_spool',
200 'entity' => 'Spool',
201 'bao' => 'CRM_Mailing_BAO_Spool',
202 'localizable' => 0,
203 'add' => NULL,
204 ],
205 'added_at' => [
206 'name' => 'added_at',
207 'type' => CRM_Utils_Type::T_TIMESTAMP,
208 'title' => ts('Added'),
209 'description' => ts('date on which this job was added.'),
210 'required' => FALSE,
211 'where' => 'civicrm_mailing_spool.added_at',
212 'default' => NULL,
213 'table_name' => 'civicrm_mailing_spool',
214 'entity' => 'Spool',
215 'bao' => 'CRM_Mailing_BAO_Spool',
216 'localizable' => 0,
217 'add' => NULL,
218 ],
219 'removed_at' => [
220 'name' => 'removed_at',
221 'type' => CRM_Utils_Type::T_TIMESTAMP,
222 'title' => ts('Removed'),
223 'description' => ts('date on which this job was removed.'),
224 'required' => FALSE,
225 'where' => 'civicrm_mailing_spool.removed_at',
226 'default' => NULL,
227 'table_name' => 'civicrm_mailing_spool',
228 'entity' => 'Spool',
229 'bao' => 'CRM_Mailing_BAO_Spool',
230 'localizable' => 0,
231 'add' => NULL,
232 ],
233 ];
234 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
235 }
236 return Civi::$statics[__CLASS__]['fields'];
237 }
238
239 /**
240 * Return a mapping from field-name to the corresponding key (as used in fields()).
241 *
242 * @return array
243 * Array(string $name => string $uniqueName).
244 */
245 public static function &fieldKeys() {
246 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
247 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
248 }
249 return Civi::$statics[__CLASS__]['fieldKeys'];
250 }
251
252 /**
253 * Returns the names of this table
254 *
255 * @return string
256 */
257 public static function getTableName() {
258 return self::$_tableName;
259 }
260
261 /**
262 * Returns if this table needs to be logged
263 *
264 * @return bool
265 */
266 public function getLog() {
267 return self::$_log;
268 }
269
270 /**
271 * Returns the list of fields that can be imported
272 *
273 * @param bool $prefix
274 *
275 * @return array
276 */
277 public static function &import($prefix = FALSE) {
278 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_spool', $prefix, []);
279 return $r;
280 }
281
282 /**
283 * Returns the list of fields that can be exported
284 *
285 * @param bool $prefix
286 *
287 * @return array
288 */
289 public static function &export($prefix = FALSE) {
290 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_spool', $prefix, []);
291 return $r;
292 }
293
294 /**
295 * Returns the list of indices
296 *
297 * @param bool $localize
298 *
299 * @return array
300 */
301 public static function indices($localize = TRUE) {
302 $indices = [];
303 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
304 }
305
306 }