Merge pull request #23274 from civicrm/5.49
[civicrm-core.git] / CRM / Mailing / Event / DAO / Unsubscribe.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Mailing/Event/Unsubscribe.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:3df64dd9a8d374056fcf215672b365d6)
10 */
11
12 /**
13 * Database access object for the Unsubscribe entity.
14 */
15 class CRM_Mailing_Event_DAO_Unsubscribe extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
18 const COMPONENT = 'CiviMail';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_mailing_event_unsubscribe';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = FALSE;
33
34 /**
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
38 */
39 public $id;
40
41 /**
42 * FK to EventQueue
43 *
44 * @var int|string
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
47 */
48 public $event_queue_id;
49
50 /**
51 * Unsubscribe at org- or group-level
52 *
53 * @var bool|string
54 * (SQL type: tinyint)
55 * Note that values will be retrieved from the database as a string.
56 */
57 public $org_unsubscribe;
58
59 /**
60 * When this delivery event occurred.
61 *
62 * @var string
63 * (SQL type: timestamp)
64 * Note that values will be retrieved from the database as a string.
65 */
66 public $time_stamp;
67
68 /**
69 * Class constructor.
70 */
71 public function __construct() {
72 $this->__table = 'civicrm_mailing_event_unsubscribe';
73 parent::__construct();
74 }
75
76 /**
77 * Returns localized title of this entity.
78 *
79 * @param bool $plural
80 * Whether to return the plural version of the title.
81 */
82 public static function getEntityTitle($plural = FALSE) {
83 return $plural ? ts('Unsubscribes') : ts('Unsubscribe');
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(), 'event_queue_id', 'civicrm_mailing_event_queue', '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('Unsubscribe ID'),
113 'required' => TRUE,
114 'where' => 'civicrm_mailing_event_unsubscribe.id',
115 'table_name' => 'civicrm_mailing_event_unsubscribe',
116 'entity' => 'Unsubscribe',
117 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
118 'localizable' => 0,
119 'html' => [
120 'type' => 'Number',
121 ],
122 'readonly' => TRUE,
123 'add' => NULL,
124 ],
125 'event_queue_id' => [
126 'name' => 'event_queue_id',
127 'type' => CRM_Utils_Type::T_INT,
128 'title' => ts('Event Queue ID'),
129 'description' => ts('FK to EventQueue'),
130 'required' => TRUE,
131 'where' => 'civicrm_mailing_event_unsubscribe.event_queue_id',
132 'table_name' => 'civicrm_mailing_event_unsubscribe',
133 'entity' => 'Unsubscribe',
134 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
135 'localizable' => 0,
136 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue',
137 'html' => [
138 'label' => ts("Event Queue"),
139 ],
140 'add' => NULL,
141 ],
142 'org_unsubscribe' => [
143 'name' => 'org_unsubscribe',
144 'type' => CRM_Utils_Type::T_BOOLEAN,
145 'title' => ts('Unsubscribe is for Organization?'),
146 'description' => ts('Unsubscribe at org- or group-level'),
147 'required' => TRUE,
148 'where' => 'civicrm_mailing_event_unsubscribe.org_unsubscribe',
149 'table_name' => 'civicrm_mailing_event_unsubscribe',
150 'entity' => 'Unsubscribe',
151 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
152 'localizable' => 0,
153 'add' => NULL,
154 ],
155 'time_stamp' => [
156 'name' => 'time_stamp',
157 'type' => CRM_Utils_Type::T_TIMESTAMP,
158 'title' => ts('Unsubscribe Timestamp'),
159 'description' => ts('When this delivery event occurred.'),
160 'required' => TRUE,
161 'where' => 'civicrm_mailing_event_unsubscribe.time_stamp',
162 'default' => 'CURRENT_TIMESTAMP',
163 'table_name' => 'civicrm_mailing_event_unsubscribe',
164 'entity' => 'Unsubscribe',
165 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
166 'localizable' => 0,
167 'add' => NULL,
168 ],
169 ];
170 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
171 }
172 return Civi::$statics[__CLASS__]['fields'];
173 }
174
175 /**
176 * Return a mapping from field-name to the corresponding key (as used in fields()).
177 *
178 * @return array
179 * Array(string $name => string $uniqueName).
180 */
181 public static function &fieldKeys() {
182 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
183 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
184 }
185 return Civi::$statics[__CLASS__]['fieldKeys'];
186 }
187
188 /**
189 * Returns the names of this table
190 *
191 * @return string
192 */
193 public static function getTableName() {
194 return self::$_tableName;
195 }
196
197 /**
198 * Returns if this table needs to be logged
199 *
200 * @return bool
201 */
202 public function getLog() {
203 return self::$_log;
204 }
205
206 /**
207 * Returns the list of fields that can be imported
208 *
209 * @param bool $prefix
210 *
211 * @return array
212 */
213 public static function &import($prefix = FALSE) {
214 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_unsubscribe', $prefix, []);
215 return $r;
216 }
217
218 /**
219 * Returns the list of fields that can be exported
220 *
221 * @param bool $prefix
222 *
223 * @return array
224 */
225 public static function &export($prefix = FALSE) {
226 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_unsubscribe', $prefix, []);
227 return $r;
228 }
229
230 /**
231 * Returns the list of indices
232 *
233 * @param bool $localize
234 *
235 * @return array
236 */
237 public static function indices($localize = TRUE) {
238 $indices = [];
239 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
240 }
241
242 }