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