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