API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[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:acb361992fd2db48c82ee7b13f8b7cf4)
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 'add' => NULL,
114 ],
115 'group_id' => [
116 'name' => 'group_id',
117 'type' => CRM_Utils_Type::T_INT,
118 'title' => ts('Mailing Subscribe Group'),
119 'description' => ts('FK to Group'),
120 'required' => TRUE,
121 'where' => 'civicrm_mailing_event_subscribe.group_id',
122 'table_name' => 'civicrm_mailing_event_subscribe',
123 'entity' => 'Subscribe',
124 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
125 'localizable' => 0,
126 'FKClassName' => 'CRM_Contact_DAO_Group',
127 'html' => [
128 'type' => 'Select',
129 ],
130 'pseudoconstant' => [
131 'table' => 'civicrm_group',
132 'keyColumn' => 'id',
133 'labelColumn' => 'title',
134 ],
135 'add' => NULL,
136 ],
137 'contact_id' => [
138 'name' => 'contact_id',
139 'type' => CRM_Utils_Type::T_INT,
140 'title' => ts('Mailing Subscribe Contact'),
141 'description' => ts('FK to Contact'),
142 'required' => TRUE,
143 'where' => 'civicrm_mailing_event_subscribe.contact_id',
144 'table_name' => 'civicrm_mailing_event_subscribe',
145 'entity' => 'Subscribe',
146 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
147 'localizable' => 0,
148 'FKClassName' => 'CRM_Contact_DAO_Contact',
149 'add' => NULL,
150 ],
151 'hash' => [
152 'name' => 'hash',
153 'type' => CRM_Utils_Type::T_STRING,
154 'title' => ts('Mailing Subscribe Hash'),
155 'description' => ts('Security hash'),
156 'required' => TRUE,
157 'maxlength' => 255,
158 'size' => CRM_Utils_Type::HUGE,
159 'where' => 'civicrm_mailing_event_subscribe.hash',
160 'table_name' => 'civicrm_mailing_event_subscribe',
161 'entity' => 'Subscribe',
162 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
163 'localizable' => 0,
164 'add' => NULL,
165 ],
166 'time_stamp' => [
167 'name' => 'time_stamp',
168 'type' => CRM_Utils_Type::T_TIMESTAMP,
169 'title' => ts('Mailing Subscribe Timestamp'),
170 'description' => ts('When this subscription event occurred.'),
171 'required' => TRUE,
172 'where' => 'civicrm_mailing_event_subscribe.time_stamp',
173 'default' => 'CURRENT_TIMESTAMP',
174 'table_name' => 'civicrm_mailing_event_subscribe',
175 'entity' => 'Subscribe',
176 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
177 'localizable' => 0,
178 'add' => NULL,
179 ],
180 ];
181 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
182 }
183 return Civi::$statics[__CLASS__]['fields'];
184 }
185
186 /**
187 * Return a mapping from field-name to the corresponding key (as used in fields()).
188 *
189 * @return array
190 * Array(string $name => string $uniqueName).
191 */
192 public static function &fieldKeys() {
193 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
194 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
195 }
196 return Civi::$statics[__CLASS__]['fieldKeys'];
197 }
198
199 /**
200 * Returns the names of this table
201 *
202 * @return string
203 */
204 public static function getTableName() {
205 return self::$_tableName;
206 }
207
208 /**
209 * Returns if this table needs to be logged
210 *
211 * @return bool
212 */
213 public function getLog() {
214 return self::$_log;
215 }
216
217 /**
218 * Returns the list of fields that can be imported
219 *
220 * @param bool $prefix
221 *
222 * @return array
223 */
224 public static function &import($prefix = FALSE) {
225 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_subscribe', $prefix, []);
226 return $r;
227 }
228
229 /**
230 * Returns the list of fields that can be exported
231 *
232 * @param bool $prefix
233 *
234 * @return array
235 */
236 public static function &export($prefix = FALSE) {
237 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_subscribe', $prefix, []);
238 return $r;
239 }
240
241 /**
242 * Returns the list of indices
243 *
244 * @param bool $localize
245 *
246 * @return array
247 */
248 public static function indices($localize = TRUE) {
249 $indices = [];
250 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
251 }
252
253 }