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