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