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