Update Copywrite year to be 2019
[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 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 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 'table_name' => 'civicrm_mailing_event_unsubscribe',
94 'entity' => 'Unsubscribe',
95 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
96 'localizable' => 0,
97 ],
98 'event_queue_id' => [
99 'name' => 'event_queue_id',
100 'type' => CRM_Utils_Type::T_INT,
101 'title' => ts('Mailing Event Queue'),
102 'description' => ts('FK to EventQueue'),
103 'required' => TRUE,
104 'table_name' => 'civicrm_mailing_event_unsubscribe',
105 'entity' => 'Unsubscribe',
106 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
107 'localizable' => 0,
108 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue',
109 ],
110 'org_unsubscribe' => [
111 'name' => 'org_unsubscribe',
112 'type' => CRM_Utils_Type::T_BOOLEAN,
113 'title' => ts('Unsubscribe is for Organization?'),
114 'description' => ts('Unsubscribe at org- or group-level'),
115 'required' => TRUE,
116 'table_name' => 'civicrm_mailing_event_unsubscribe',
117 'entity' => 'Unsubscribe',
118 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
119 'localizable' => 0,
120 ],
121 'time_stamp' => [
122 'name' => 'time_stamp',
123 'type' => CRM_Utils_Type::T_TIMESTAMP,
124 'title' => ts('Unsubscribe Timestamp'),
125 'description' => ts('When this delivery event occurred.'),
126 'required' => TRUE,
127 'default' => 'CURRENT_TIMESTAMP',
128 'table_name' => 'civicrm_mailing_event_unsubscribe',
129 'entity' => 'Unsubscribe',
130 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
131 'localizable' => 0,
132 ],
133 ];
134 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
135 }
136 return Civi::$statics[__CLASS__]['fields'];
137 }
138
139 /**
140 * Return a mapping from field-name to the corresponding key (as used in fields()).
141 *
142 * @return array
143 * Array(string $name => string $uniqueName).
144 */
145 public static function &fieldKeys() {
146 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
147 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
148 }
149 return Civi::$statics[__CLASS__]['fieldKeys'];
150 }
151
152 /**
153 * Returns the names of this table
154 *
155 * @return string
156 */
157 public static function getTableName() {
158 return self::$_tableName;
159 }
160
161 /**
162 * Returns if this table needs to be logged
163 *
164 * @return bool
165 */
166 public function getLog() {
167 return self::$_log;
168 }
169
170 /**
171 * Returns the list of fields that can be imported
172 *
173 * @param bool $prefix
174 *
175 * @return array
176 */
177 public static function &import($prefix = FALSE) {
178 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_unsubscribe', $prefix, []);
179 return $r;
180 }
181
182 /**
183 * Returns the list of fields that can be exported
184 *
185 * @param bool $prefix
186 *
187 * @return array
188 */
189 public static function &export($prefix = FALSE) {
190 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_unsubscribe', $prefix, []);
191 return $r;
192 }
193
194 /**
195 * Returns the list of indices
196 *
197 * @param bool $localize
198 *
199 * @return array
200 */
201 public static function indices($localize = TRUE) {
202 $indices = [];
203 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
204 }
205
206 }