Merge pull request #16004 from civicrm/5.20
[civicrm-core.git] / CRM / Mailing / Event / DAO / Subscribe.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/Subscribe.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:081be4da95465c1f28e13d936b372345)
10 */
11
12 /**
13 * Database access object for the Subscribe entity.
14 */
15 class CRM_Mailing_Event_DAO_Subscribe 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_subscribe';
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
33 */
34 public $id;
35
36 /**
37 * FK to Group
38 *
39 * @var int
40 */
41 public $group_id;
42
43 /**
44 * FK to Contact
45 *
46 * @var int
47 */
48 public $contact_id;
49
50 /**
51 * Security hash
52 *
53 * @var string
54 */
55 public $hash;
56
57 /**
58 * When this subscription event occurred.
59 *
60 * @var timestamp
61 */
62 public $time_stamp;
63
64 /**
65 * Class constructor.
66 */
67 public function __construct() {
68 $this->__table = 'civicrm_mailing_event_subscribe';
69 parent::__construct();
70 }
71
72 /**
73 * Returns foreign keys and entity references.
74 *
75 * @return array
76 * [CRM_Core_Reference_Interface]
77 */
78 public static function getReferenceColumns() {
79 if (!isset(Civi::$statics[__CLASS__]['links'])) {
80 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
81 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id');
82 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
83 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
84 }
85 return Civi::$statics[__CLASS__]['links'];
86 }
87
88 /**
89 * Returns all the column names of this table
90 *
91 * @return array
92 */
93 public static function &fields() {
94 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
95 Civi::$statics[__CLASS__]['fields'] = [
96 'id' => [
97 'name' => 'id',
98 'type' => CRM_Utils_Type::T_INT,
99 'title' => ts('Mailing Subscribe ID'),
100 'required' => TRUE,
101 'where' => 'civicrm_mailing_event_subscribe.id',
102 'table_name' => 'civicrm_mailing_event_subscribe',
103 'entity' => 'Subscribe',
104 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
105 'localizable' => 0,
106 ],
107 'group_id' => [
108 'name' => 'group_id',
109 'type' => CRM_Utils_Type::T_INT,
110 'title' => ts('Mailing Subscribe Group'),
111 'description' => ts('FK to Group'),
112 'required' => TRUE,
113 'where' => 'civicrm_mailing_event_subscribe.group_id',
114 'table_name' => 'civicrm_mailing_event_subscribe',
115 'entity' => 'Subscribe',
116 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
117 'localizable' => 0,
118 'FKClassName' => 'CRM_Contact_DAO_Group',
119 'html' => [
120 'type' => 'Select',
121 ],
122 'pseudoconstant' => [
123 'table' => 'civicrm_group',
124 'keyColumn' => 'id',
125 'labelColumn' => 'title',
126 ],
127 ],
128 'contact_id' => [
129 'name' => 'contact_id',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('Mailing Subscribe Contact'),
132 'description' => ts('FK to Contact'),
133 'required' => TRUE,
134 'where' => 'civicrm_mailing_event_subscribe.contact_id',
135 'table_name' => 'civicrm_mailing_event_subscribe',
136 'entity' => 'Subscribe',
137 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
138 'localizable' => 0,
139 'FKClassName' => 'CRM_Contact_DAO_Contact',
140 ],
141 'hash' => [
142 'name' => 'hash',
143 'type' => CRM_Utils_Type::T_STRING,
144 'title' => ts('Mailing Subscribe Hash'),
145 'description' => ts('Security hash'),
146 'required' => TRUE,
147 'maxlength' => 255,
148 'size' => CRM_Utils_Type::HUGE,
149 'where' => 'civicrm_mailing_event_subscribe.hash',
150 'table_name' => 'civicrm_mailing_event_subscribe',
151 'entity' => 'Subscribe',
152 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
153 'localizable' => 0,
154 ],
155 'time_stamp' => [
156 'name' => 'time_stamp',
157 'type' => CRM_Utils_Type::T_TIMESTAMP,
158 'title' => ts('Mailing Subscribe Timestamp'),
159 'description' => ts('When this subscription event occurred.'),
160 'required' => TRUE,
161 'where' => 'civicrm_mailing_event_subscribe.time_stamp',
162 'default' => 'CURRENT_TIMESTAMP',
163 'table_name' => 'civicrm_mailing_event_subscribe',
164 'entity' => 'Subscribe',
165 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
166 'localizable' => 0,
167 ],
168 ];
169 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
170 }
171 return Civi::$statics[__CLASS__]['fields'];
172 }
173
174 /**
175 * Return a mapping from field-name to the corresponding key (as used in fields()).
176 *
177 * @return array
178 * Array(string $name => string $uniqueName).
179 */
180 public static function &fieldKeys() {
181 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
182 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
183 }
184 return Civi::$statics[__CLASS__]['fieldKeys'];
185 }
186
187 /**
188 * Returns the names of this table
189 *
190 * @return string
191 */
192 public static function getTableName() {
193 return self::$_tableName;
194 }
195
196 /**
197 * Returns if this table needs to be logged
198 *
199 * @return bool
200 */
201 public function getLog() {
202 return self::$_log;
203 }
204
205 /**
206 * Returns the list of fields that can be imported
207 *
208 * @param bool $prefix
209 *
210 * @return array
211 */
212 public static function &import($prefix = FALSE) {
213 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_subscribe', $prefix, []);
214 return $r;
215 }
216
217 /**
218 * Returns the list of fields that can be exported
219 *
220 * @param bool $prefix
221 *
222 * @return array
223 */
224 public static function &export($prefix = FALSE) {
225 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_subscribe', $prefix, []);
226 return $r;
227 }
228
229 /**
230 * Returns the list of indices
231 *
232 * @param bool $localize
233 *
234 * @return array
235 */
236 public static function indices($localize = TRUE) {
237 $indices = [];
238 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
239 }
240
241 }