Merge pull request #14326 from civicrm/5.14
[civicrm-core.git] / CRM / Mailing / DAO / Spool.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Mailing/Spool.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:55c696d855ff602c9e097bd9ccff0971)
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 receipients 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 foreign keys and entity references.
88 *
89 * @return array
90 * [CRM_Core_Reference_Interface]
91 */
92 public static function getReferenceColumns() {
93 if (!isset(Civi::$statics[__CLASS__]['links'])) {
94 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
95 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'job_id', 'civicrm_mailing_job', 'id');
96 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
97 }
98 return Civi::$statics[__CLASS__]['links'];
99 }
100
101 /**
102 * Returns all the column names of this table
103 *
104 * @return array
105 */
106 public static function &fields() {
107 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
108 Civi::$statics[__CLASS__]['fields'] = [
109 'id' => [
110 'name' => 'id',
111 'type' => CRM_Utils_Type::T_INT,
112 'title' => ts('Spool ID'),
113 'required' => TRUE,
114 'where' => 'civicrm_mailing_spool.id',
115 'table_name' => 'civicrm_mailing_spool',
116 'entity' => 'Spool',
117 'bao' => 'CRM_Mailing_BAO_Spool',
118 'localizable' => 0,
119 ],
120 'job_id' => [
121 'name' => 'job_id',
122 'type' => CRM_Utils_Type::T_INT,
123 'title' => ts('Mailing Job'),
124 'description' => ts('The ID of the Job .'),
125 'required' => TRUE,
126 'where' => 'civicrm_mailing_spool.job_id',
127 'table_name' => 'civicrm_mailing_spool',
128 'entity' => 'Spool',
129 'bao' => 'CRM_Mailing_BAO_Spool',
130 'localizable' => 0,
131 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
132 ],
133 'recipient_email' => [
134 'name' => 'recipient_email',
135 'type' => CRM_Utils_Type::T_TEXT,
136 'title' => ts('Recipient Email'),
137 'description' => ts('The email of the receipients this mail is to be sent.'),
138 'where' => 'civicrm_mailing_spool.recipient_email',
139 'table_name' => 'civicrm_mailing_spool',
140 'entity' => 'Spool',
141 'bao' => 'CRM_Mailing_BAO_Spool',
142 'localizable' => 0,
143 ],
144 'headers' => [
145 'name' => 'headers',
146 'type' => CRM_Utils_Type::T_TEXT,
147 'title' => ts('Headers'),
148 'description' => ts('The header information of this mailing .'),
149 'where' => 'civicrm_mailing_spool.headers',
150 'table_name' => 'civicrm_mailing_spool',
151 'entity' => 'Spool',
152 'bao' => 'CRM_Mailing_BAO_Spool',
153 'localizable' => 0,
154 ],
155 'body' => [
156 'name' => 'body',
157 'type' => CRM_Utils_Type::T_TEXT,
158 'title' => ts('Body'),
159 'description' => ts('The body of this mailing.'),
160 'where' => 'civicrm_mailing_spool.body',
161 'table_name' => 'civicrm_mailing_spool',
162 'entity' => 'Spool',
163 'bao' => 'CRM_Mailing_BAO_Spool',
164 'localizable' => 0,
165 ],
166 'added_at' => [
167 'name' => 'added_at',
168 'type' => CRM_Utils_Type::T_TIMESTAMP,
169 'title' => ts('Added'),
170 'description' => ts('date on which this job was added.'),
171 'required' => FALSE,
172 'where' => 'civicrm_mailing_spool.added_at',
173 'default' => 'NULL',
174 'table_name' => 'civicrm_mailing_spool',
175 'entity' => 'Spool',
176 'bao' => 'CRM_Mailing_BAO_Spool',
177 'localizable' => 0,
178 ],
179 'removed_at' => [
180 'name' => 'removed_at',
181 'type' => CRM_Utils_Type::T_TIMESTAMP,
182 'title' => ts('Removed'),
183 'description' => ts('date on which this job was removed.'),
184 'required' => FALSE,
185 'where' => 'civicrm_mailing_spool.removed_at',
186 'default' => 'NULL',
187 'table_name' => 'civicrm_mailing_spool',
188 'entity' => 'Spool',
189 'bao' => 'CRM_Mailing_BAO_Spool',
190 'localizable' => 0,
191 ],
192 ];
193 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
194 }
195 return Civi::$statics[__CLASS__]['fields'];
196 }
197
198 /**
199 * Return a mapping from field-name to the corresponding key (as used in fields()).
200 *
201 * @return array
202 * Array(string $name => string $uniqueName).
203 */
204 public static function &fieldKeys() {
205 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
206 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
207 }
208 return Civi::$statics[__CLASS__]['fieldKeys'];
209 }
210
211 /**
212 * Returns the names of this table
213 *
214 * @return string
215 */
216 public static function getTableName() {
217 return self::$_tableName;
218 }
219
220 /**
221 * Returns if this table needs to be logged
222 *
223 * @return bool
224 */
225 public function getLog() {
226 return self::$_log;
227 }
228
229 /**
230 * Returns the list of fields that can be imported
231 *
232 * @param bool $prefix
233 *
234 * @return array
235 */
236 public static function &import($prefix = FALSE) {
237 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_spool', $prefix, []);
238 return $r;
239 }
240
241 /**
242 * Returns the list of fields that can be exported
243 *
244 * @param bool $prefix
245 *
246 * @return array
247 */
248 public static function &export($prefix = FALSE) {
249 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_spool', $prefix, []);
250 return $r;
251 }
252
253 /**
254 * Returns the list of indices
255 *
256 * @param bool $localize
257 *
258 * @return array
259 */
260 public static function indices($localize = TRUE) {
261 $indices = [];
262 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
263 }
264
265 }