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