Merge pull request #17719 from civicrm/5.27
[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:97eb613e24b342aeb86b6e82b740ce7c)
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 localized title of this entity.
74 */
75 public static function getEntityTitle() {
76 return ts('Subscribes');
77 }
78
79 /**
80 * Returns foreign keys and entity references.
81 *
82 * @return array
83 * [CRM_Core_Reference_Interface]
84 */
85 public static function getReferenceColumns() {
86 if (!isset(Civi::$statics[__CLASS__]['links'])) {
87 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
88 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id');
89 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
90 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
91 }
92 return Civi::$statics[__CLASS__]['links'];
93 }
94
95 /**
96 * Returns all the column names of this table
97 *
98 * @return array
99 */
100 public static function &fields() {
101 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
102 Civi::$statics[__CLASS__]['fields'] = [
103 'id' => [
104 'name' => 'id',
105 'type' => CRM_Utils_Type::T_INT,
106 'title' => ts('Mailing Subscribe ID'),
107 'required' => TRUE,
108 'where' => 'civicrm_mailing_event_subscribe.id',
109 'table_name' => 'civicrm_mailing_event_subscribe',
110 'entity' => 'Subscribe',
111 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
112 'localizable' => 0,
113 ],
114 'group_id' => [
115 'name' => 'group_id',
116 'type' => CRM_Utils_Type::T_INT,
117 'title' => ts('Mailing Subscribe Group'),
118 'description' => ts('FK to Group'),
119 'required' => TRUE,
120 'where' => 'civicrm_mailing_event_subscribe.group_id',
121 'table_name' => 'civicrm_mailing_event_subscribe',
122 'entity' => 'Subscribe',
123 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
124 'localizable' => 0,
125 'FKClassName' => 'CRM_Contact_DAO_Group',
126 'html' => [
127 'type' => 'Select',
128 ],
129 'pseudoconstant' => [
130 'table' => 'civicrm_group',
131 'keyColumn' => 'id',
132 'labelColumn' => 'title',
133 ],
134 ],
135 'contact_id' => [
136 'name' => 'contact_id',
137 'type' => CRM_Utils_Type::T_INT,
138 'title' => ts('Mailing Subscribe Contact'),
139 'description' => ts('FK to Contact'),
140 'required' => TRUE,
141 'where' => 'civicrm_mailing_event_subscribe.contact_id',
142 'table_name' => 'civicrm_mailing_event_subscribe',
143 'entity' => 'Subscribe',
144 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
145 'localizable' => 0,
146 'FKClassName' => 'CRM_Contact_DAO_Contact',
147 ],
148 'hash' => [
149 'name' => 'hash',
150 'type' => CRM_Utils_Type::T_STRING,
151 'title' => ts('Mailing Subscribe Hash'),
152 'description' => ts('Security hash'),
153 'required' => TRUE,
154 'maxlength' => 255,
155 'size' => CRM_Utils_Type::HUGE,
156 'where' => 'civicrm_mailing_event_subscribe.hash',
157 'table_name' => 'civicrm_mailing_event_subscribe',
158 'entity' => 'Subscribe',
159 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
160 'localizable' => 0,
161 ],
162 'time_stamp' => [
163 'name' => 'time_stamp',
164 'type' => CRM_Utils_Type::T_TIMESTAMP,
165 'title' => ts('Mailing Subscribe Timestamp'),
166 'description' => ts('When this subscription event occurred.'),
167 'required' => TRUE,
168 'where' => 'civicrm_mailing_event_subscribe.time_stamp',
169 'default' => 'CURRENT_TIMESTAMP',
170 'table_name' => 'civicrm_mailing_event_subscribe',
171 'entity' => 'Subscribe',
172 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
173 'localizable' => 0,
174 ],
175 ];
176 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
177 }
178 return Civi::$statics[__CLASS__]['fields'];
179 }
180
181 /**
182 * Return a mapping from field-name to the corresponding key (as used in fields()).
183 *
184 * @return array
185 * Array(string $name => string $uniqueName).
186 */
187 public static function &fieldKeys() {
188 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
189 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
190 }
191 return Civi::$statics[__CLASS__]['fieldKeys'];
192 }
193
194 /**
195 * Returns the names of this table
196 *
197 * @return string
198 */
199 public static function getTableName() {
200 return self::$_tableName;
201 }
202
203 /**
204 * Returns if this table needs to be logged
205 *
206 * @return bool
207 */
208 public function getLog() {
209 return self::$_log;
210 }
211
212 /**
213 * Returns the list of fields that can be imported
214 *
215 * @param bool $prefix
216 *
217 * @return array
218 */
219 public static function &import($prefix = FALSE) {
220 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_subscribe', $prefix, []);
221 return $r;
222 }
223
224 /**
225 * Returns the list of fields that can be exported
226 *
227 * @param bool $prefix
228 *
229 * @return array
230 */
231 public static function &export($prefix = FALSE) {
232 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_subscribe', $prefix, []);
233 return $r;
234 }
235
236 /**
237 * Returns the list of indices
238 *
239 * @param bool $localize
240 *
241 * @return array
242 */
243 public static function indices($localize = TRUE) {
244 $indices = [];
245 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
246 }
247
248 }