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