API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[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:d16e98421cdacbf5ad1b5542810fca6c)
10 */
11
12 /**
13 * Database access object for the Unsubscribe entity.
14 */
15 class CRM_Mailing_Event_DAO_Unsubscribe 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_event_unsubscribe';
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 * FK to EventQueue
38 *
39 * @var int
40 */
41 public $event_queue_id;
42
43 /**
44 * Unsubscribe at org- or group-level
45 *
46 * @var bool
47 */
48 public $org_unsubscribe;
49
50 /**
51 * When this delivery event occurred.
52 *
53 * @var timestamp
54 */
55 public $time_stamp;
56
57 /**
58 * Class constructor.
59 */
60 public function __construct() {
61 $this->__table = 'civicrm_mailing_event_unsubscribe';
62 parent::__construct();
63 }
64
65 /**
66 * Returns localized title of this entity.
67 */
68 public static function getEntityTitle() {
69 return ts('Unsubscribes');
70 }
71
72 /**
73 * Returns foreign keys and entity references.
74 *
75 * @return array
76 * [CRM_Core_Reference_Interface]
77 */
78 public static function getReferenceColumns() {
79 if (!isset(Civi::$statics[__CLASS__]['links'])) {
80 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
81 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id');
82 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
83 }
84 return Civi::$statics[__CLASS__]['links'];
85 }
86
87 /**
88 * Returns all the column names of this table
89 *
90 * @return array
91 */
92 public static function &fields() {
93 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
94 Civi::$statics[__CLASS__]['fields'] = [
95 'id' => [
96 'name' => 'id',
97 'type' => CRM_Utils_Type::T_INT,
98 'title' => ts('Unsubscribe ID'),
99 'required' => TRUE,
100 'where' => 'civicrm_mailing_event_unsubscribe.id',
101 'table_name' => 'civicrm_mailing_event_unsubscribe',
102 'entity' => 'Unsubscribe',
103 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
104 'localizable' => 0,
105 'add' => NULL,
106 ],
107 'event_queue_id' => [
108 'name' => 'event_queue_id',
109 'type' => CRM_Utils_Type::T_INT,
110 'title' => ts('Mailing Event Queue'),
111 'description' => ts('FK to EventQueue'),
112 'required' => TRUE,
113 'where' => 'civicrm_mailing_event_unsubscribe.event_queue_id',
114 'table_name' => 'civicrm_mailing_event_unsubscribe',
115 'entity' => 'Unsubscribe',
116 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
117 'localizable' => 0,
118 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue',
119 'add' => NULL,
120 ],
121 'org_unsubscribe' => [
122 'name' => 'org_unsubscribe',
123 'type' => CRM_Utils_Type::T_BOOLEAN,
124 'title' => ts('Unsubscribe is for Organization?'),
125 'description' => ts('Unsubscribe at org- or group-level'),
126 'required' => TRUE,
127 'where' => 'civicrm_mailing_event_unsubscribe.org_unsubscribe',
128 'table_name' => 'civicrm_mailing_event_unsubscribe',
129 'entity' => 'Unsubscribe',
130 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
131 'localizable' => 0,
132 'add' => NULL,
133 ],
134 'time_stamp' => [
135 'name' => 'time_stamp',
136 'type' => CRM_Utils_Type::T_TIMESTAMP,
137 'title' => ts('Unsubscribe Timestamp'),
138 'description' => ts('When this delivery event occurred.'),
139 'required' => TRUE,
140 'where' => 'civicrm_mailing_event_unsubscribe.time_stamp',
141 'default' => 'CURRENT_TIMESTAMP',
142 'table_name' => 'civicrm_mailing_event_unsubscribe',
143 'entity' => 'Unsubscribe',
144 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
145 'localizable' => 0,
146 'add' => NULL,
147 ],
148 ];
149 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
150 }
151 return Civi::$statics[__CLASS__]['fields'];
152 }
153
154 /**
155 * Return a mapping from field-name to the corresponding key (as used in fields()).
156 *
157 * @return array
158 * Array(string $name => string $uniqueName).
159 */
160 public static function &fieldKeys() {
161 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
162 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
163 }
164 return Civi::$statics[__CLASS__]['fieldKeys'];
165 }
166
167 /**
168 * Returns the names of this table
169 *
170 * @return string
171 */
172 public static function getTableName() {
173 return self::$_tableName;
174 }
175
176 /**
177 * Returns if this table needs to be logged
178 *
179 * @return bool
180 */
181 public function getLog() {
182 return self::$_log;
183 }
184
185 /**
186 * Returns the list of fields that can be imported
187 *
188 * @param bool $prefix
189 *
190 * @return array
191 */
192 public static function &import($prefix = FALSE) {
193 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_unsubscribe', $prefix, []);
194 return $r;
195 }
196
197 /**
198 * Returns the list of fields that can be exported
199 *
200 * @param bool $prefix
201 *
202 * @return array
203 */
204 public static function &export($prefix = FALSE) {
205 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_unsubscribe', $prefix, []);
206 return $r;
207 }
208
209 /**
210 * Returns the list of indices
211 *
212 * @param bool $localize
213 *
214 * @return array
215 */
216 public static function indices($localize = TRUE) {
217 $indices = [];
218 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
219 }
220
221 }