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