Add "labelField" metadata 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
8ab43c93 9 * (GenCodeChecksum:c682e199c6d4026f4b2e00c184d066ae)
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,
a9d0587b 132 'add' => NULL,
c3fc2621
CW
133 ],
134 'job_id' => [
e501603b
TO
135 'name' => 'job_id',
136 'type' => CRM_Utils_Type::T_INT,
c3fc2621 137 'title' => ts('Mailing Job'),
215b423e 138 'description' => ts('The ID of the Job .'),
c3fc2621 139 'required' => TRUE,
a36434b9 140 'where' => 'civicrm_mailing_spool.job_id',
522a26c9 141 'table_name' => 'civicrm_mailing_spool',
142 'entity' => 'Spool',
143 'bao' => 'CRM_Mailing_BAO_Spool',
6a7e5e5d 144 'localizable' => 0,
e501603b 145 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
a9d0587b 146 'add' => NULL,
c3fc2621
CW
147 ],
148 'recipient_email' => [
e501603b
TO
149 'name' => 'recipient_email',
150 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 151 'title' => ts('Recipient Email'),
e017d14b 152 'description' => ts('The email of the recipients this mail is to be sent.'),
a36434b9 153 'where' => 'civicrm_mailing_spool.recipient_email',
522a26c9 154 'table_name' => 'civicrm_mailing_spool',
155 'entity' => 'Spool',
156 'bao' => 'CRM_Mailing_BAO_Spool',
6a7e5e5d 157 'localizable' => 0,
a9d0587b 158 'add' => NULL,
c3fc2621
CW
159 ],
160 'headers' => [
e501603b
TO
161 'name' => 'headers',
162 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 163 'title' => ts('Headers'),
215b423e 164 'description' => ts('The header information of this mailing .'),
a36434b9 165 'where' => 'civicrm_mailing_spool.headers',
522a26c9 166 'table_name' => 'civicrm_mailing_spool',
167 'entity' => 'Spool',
168 'bao' => 'CRM_Mailing_BAO_Spool',
6a7e5e5d 169 'localizable' => 0,
a9d0587b 170 'add' => NULL,
c3fc2621
CW
171 ],
172 'body' => [
e501603b
TO
173 'name' => 'body',
174 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 175 'title' => ts('Body'),
215b423e 176 'description' => ts('The body of this mailing.'),
a36434b9 177 'where' => 'civicrm_mailing_spool.body',
522a26c9 178 'table_name' => 'civicrm_mailing_spool',
179 'entity' => 'Spool',
180 'bao' => 'CRM_Mailing_BAO_Spool',
6a7e5e5d 181 'localizable' => 0,
a9d0587b 182 'add' => NULL,
c3fc2621
CW
183 ],
184 'added_at' => [
e501603b 185 'name' => 'added_at',
6c2b97b7 186 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 187 'title' => ts('Added'),
215b423e 188 'description' => ts('date on which this job was added.'),
c3fc2621 189 'required' => FALSE,
a36434b9 190 'where' => 'civicrm_mailing_spool.added_at',
6c2b97b7 191 'default' => 'NULL',
522a26c9 192 'table_name' => 'civicrm_mailing_spool',
193 'entity' => 'Spool',
194 'bao' => 'CRM_Mailing_BAO_Spool',
6a7e5e5d 195 'localizable' => 0,
a9d0587b 196 'add' => NULL,
c3fc2621
CW
197 ],
198 'removed_at' => [
e501603b 199 'name' => 'removed_at',
6c2b97b7 200 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 201 'title' => ts('Removed'),
215b423e 202 'description' => ts('date on which this job was removed.'),
c3fc2621 203 'required' => FALSE,
a36434b9 204 'where' => 'civicrm_mailing_spool.removed_at',
6c2b97b7 205 'default' => 'NULL',
522a26c9 206 'table_name' => 'civicrm_mailing_spool',
207 'entity' => 'Spool',
208 'bao' => 'CRM_Mailing_BAO_Spool',
6a7e5e5d 209 'localizable' => 0,
a9d0587b 210 'add' => NULL,
c3fc2621
CW
211 ],
212 ];
346aaaba 213 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 214 }
346aaaba 215 return Civi::$statics[__CLASS__]['fields'];
e501603b 216 }
c3fc2621 217
e501603b 218 /**
bd8e0b14 219 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
220 *
221 * @return array
bd8e0b14 222 * Array(string $name => string $uniqueName).
e501603b 223 */
c3fc2621 224 public static function &fieldKeys() {
bd8e0b14
TO
225 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
226 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 227 }
bd8e0b14 228 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 229 }
c3fc2621 230
e501603b
TO
231 /**
232 * Returns the names of this table
233 *
234 * @return string
235 */
c3fc2621 236 public static function getTableName() {
e501603b
TO
237 return self::$_tableName;
238 }
c3fc2621 239
e501603b
TO
240 /**
241 * Returns if this table needs to be logged
242 *
c3fc2621 243 * @return bool
e501603b 244 */
c3fc2621 245 public function getLog() {
e501603b
TO
246 return self::$_log;
247 }
c3fc2621 248
e501603b
TO
249 /**
250 * Returns the list of fields that can be imported
251 *
252 * @param bool $prefix
253 *
254 * @return array
255 */
c3fc2621
CW
256 public static function &import($prefix = FALSE) {
257 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_spool', $prefix, []);
60808919 258 return $r;
e501603b 259 }
c3fc2621 260
e501603b
TO
261 /**
262 * Returns the list of fields that can be exported
263 *
264 * @param bool $prefix
265 *
266 * @return array
267 */
c3fc2621
CW
268 public static function &export($prefix = FALSE) {
269 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_spool', $prefix, []);
60808919 270 return $r;
e501603b 271 }
c3fc2621 272
e7a6b91a
AS
273 /**
274 * Returns the list of indices
c3fc2621
CW
275 *
276 * @param bool $localize
277 *
278 * @return array
e7a6b91a
AS
279 */
280 public static function indices($localize = TRUE) {
c3fc2621 281 $indices = [];
e7a6b91a
AS
282 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
283 }
c3fc2621 284
e501603b 285}