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