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