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