Merge pull request #14091 from civicrm/5.13
[civicrm-core.git] / CRM / Mailing / Event / DAO / Unsubscribe.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Mailing/Event/Unsubscribe.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e2a14fa1a63bd3f7b4e4fb4864a8560e)
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 unsigned
33 */
34 public $id;
35
36 /**
37 * FK to EventQueue
38 *
39 * @var int unsigned
40 */
41 public $event_queue_id;
42
43 /**
44 * Unsubscribe at org- or group-level
45 *
46 * @var boolean
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 foreign keys and entity references.
67 *
68 * @return array
69 * [CRM_Core_Reference_Interface]
70 */
71 public static function getReferenceColumns() {
72 if (!isset(Civi::$statics[__CLASS__]['links'])) {
73 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
74 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id');
75 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
76 }
77 return Civi::$statics[__CLASS__]['links'];
78 }
79
80 /**
81 * Returns all the column names of this table
82 *
83 * @return array
84 */
85 public static function &fields() {
86 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
87 Civi::$statics[__CLASS__]['fields'] = [
88 'id' => [
89 'name' => 'id',
90 'type' => CRM_Utils_Type::T_INT,
91 'title' => ts('Unsubscribe ID'),
92 'required' => TRUE,
93 'where' => 'civicrm_mailing_event_unsubscribe.id',
94 'table_name' => 'civicrm_mailing_event_unsubscribe',
95 'entity' => 'Unsubscribe',
96 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
97 'localizable' => 0,
98 ],
99 'event_queue_id' => [
100 'name' => 'event_queue_id',
101 'type' => CRM_Utils_Type::T_INT,
102 'title' => ts('Mailing Event Queue'),
103 'description' => ts('FK to EventQueue'),
104 'required' => TRUE,
105 'where' => 'civicrm_mailing_event_unsubscribe.event_queue_id',
106 'table_name' => 'civicrm_mailing_event_unsubscribe',
107 'entity' => 'Unsubscribe',
108 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
109 'localizable' => 0,
110 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue',
111 ],
112 'org_unsubscribe' => [
113 'name' => 'org_unsubscribe',
114 'type' => CRM_Utils_Type::T_BOOLEAN,
115 'title' => ts('Unsubscribe is for Organization?'),
116 'description' => ts('Unsubscribe at org- or group-level'),
117 'required' => TRUE,
118 'where' => 'civicrm_mailing_event_unsubscribe.org_unsubscribe',
119 'table_name' => 'civicrm_mailing_event_unsubscribe',
120 'entity' => 'Unsubscribe',
121 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
122 'localizable' => 0,
123 ],
124 'time_stamp' => [
125 'name' => 'time_stamp',
126 'type' => CRM_Utils_Type::T_TIMESTAMP,
127 'title' => ts('Unsubscribe Timestamp'),
128 'description' => ts('When this delivery event occurred.'),
129 'required' => TRUE,
130 'where' => 'civicrm_mailing_event_unsubscribe.time_stamp',
131 'default' => 'CURRENT_TIMESTAMP',
132 'table_name' => 'civicrm_mailing_event_unsubscribe',
133 'entity' => 'Unsubscribe',
134 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
135 'localizable' => 0,
136 ],
137 ];
138 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
139 }
140 return Civi::$statics[__CLASS__]['fields'];
141 }
142
143 /**
144 * Return a mapping from field-name to the corresponding key (as used in fields()).
145 *
146 * @return array
147 * Array(string $name => string $uniqueName).
148 */
149 public static function &fieldKeys() {
150 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
151 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
152 }
153 return Civi::$statics[__CLASS__]['fieldKeys'];
154 }
155
156 /**
157 * Returns the names of this table
158 *
159 * @return string
160 */
161 public static function getTableName() {
162 return self::$_tableName;
163 }
164
165 /**
166 * Returns if this table needs to be logged
167 *
168 * @return bool
169 */
170 public function getLog() {
171 return self::$_log;
172 }
173
174 /**
175 * Returns the list of fields that can be imported
176 *
177 * @param bool $prefix
178 *
179 * @return array
180 */
181 public static function &import($prefix = FALSE) {
182 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_unsubscribe', $prefix, []);
183 return $r;
184 }
185
186 /**
187 * Returns the list of fields that can be exported
188 *
189 * @param bool $prefix
190 *
191 * @return array
192 */
193 public static function &export($prefix = FALSE) {
194 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_unsubscribe', $prefix, []);
195 return $r;
196 }
197
198 /**
199 * Returns the list of indices
200 *
201 * @param bool $localize
202 *
203 * @return array
204 */
205 public static function indices($localize = TRUE) {
206 $indices = [];
207 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
208 }
209
210 }