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