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