Merge pull request #13295 from andrewpthompson/andrewpthompson-dev-core-602
[civicrm-core.git] / CRM / Mailing / Event / DAO / Subscribe.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Mailing/Event/Subscribe.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a18362fb8ab1b7cd9b6f5450fcf367f5)
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 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 static $_log = FALSE;
30
31 /**
32 * @var int unsigned
33 */
34 public $id;
35
36 /**
37 * FK to Group
38 *
39 * @var int unsigned
40 */
41 public $group_id;
42
43 /**
44 * FK to Contact
45 *
46 * @var int unsigned
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 'table_name' => 'civicrm_mailing_event_subscribe',
102 'entity' => 'Subscribe',
103 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
104 'localizable' => 0,
105 ],
106 'group_id' => [
107 'name' => 'group_id',
108 'type' => CRM_Utils_Type::T_INT,
109 'title' => ts('Mailing Subscribe Group'),
110 'description' => ts('FK to Group'),
111 'required' => TRUE,
112 'table_name' => 'civicrm_mailing_event_subscribe',
113 'entity' => 'Subscribe',
114 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
115 'localizable' => 0,
116 'FKClassName' => 'CRM_Contact_DAO_Group',
117 'html' => [
118 'type' => 'Select',
119 ],
120 'pseudoconstant' => [
121 'table' => 'civicrm_group',
122 'keyColumn' => 'id',
123 'labelColumn' => 'title',
124 ]
125 ],
126 'contact_id' => [
127 'name' => 'contact_id',
128 'type' => CRM_Utils_Type::T_INT,
129 'title' => ts('Mailing Subscribe Contact'),
130 'description' => ts('FK to Contact'),
131 'required' => TRUE,
132 'table_name' => 'civicrm_mailing_event_subscribe',
133 'entity' => 'Subscribe',
134 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
135 'localizable' => 0,
136 'FKClassName' => 'CRM_Contact_DAO_Contact',
137 ],
138 'hash' => [
139 'name' => 'hash',
140 'type' => CRM_Utils_Type::T_STRING,
141 'title' => ts('Mailing Subscribe Hash'),
142 'description' => ts('Security hash'),
143 'required' => TRUE,
144 'maxlength' => 255,
145 'size' => CRM_Utils_Type::HUGE,
146 'table_name' => 'civicrm_mailing_event_subscribe',
147 'entity' => 'Subscribe',
148 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
149 'localizable' => 0,
150 ],
151 'time_stamp' => [
152 'name' => 'time_stamp',
153 'type' => CRM_Utils_Type::T_TIMESTAMP,
154 'title' => ts('Mailing Subscribe Timestamp'),
155 'description' => ts('When this subscription event occurred.'),
156 'required' => TRUE,
157 'default' => 'CURRENT_TIMESTAMP',
158 'table_name' => 'civicrm_mailing_event_subscribe',
159 'entity' => 'Subscribe',
160 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
161 'localizable' => 0,
162 ],
163 ];
164 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
165 }
166 return Civi::$statics[__CLASS__]['fields'];
167 }
168
169 /**
170 * Return a mapping from field-name to the corresponding key (as used in fields()).
171 *
172 * @return array
173 * Array(string $name => string $uniqueName).
174 */
175 public static function &fieldKeys() {
176 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
177 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
178 }
179 return Civi::$statics[__CLASS__]['fieldKeys'];
180 }
181
182 /**
183 * Returns the names of this table
184 *
185 * @return string
186 */
187 public static function getTableName() {
188 return self::$_tableName;
189 }
190
191 /**
192 * Returns if this table needs to be logged
193 *
194 * @return bool
195 */
196 public function getLog() {
197 return self::$_log;
198 }
199
200 /**
201 * Returns the list of fields that can be imported
202 *
203 * @param bool $prefix
204 *
205 * @return array
206 */
207 public static function &import($prefix = FALSE) {
208 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_subscribe', $prefix, []);
209 return $r;
210 }
211
212 /**
213 * Returns the list of fields that can be exported
214 *
215 * @param bool $prefix
216 *
217 * @return array
218 */
219 public static function &export($prefix = FALSE) {
220 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_subscribe', $prefix, []);
221 return $r;
222 }
223
224 /**
225 * Returns the list of indices
226 *
227 * @param bool $localize
228 *
229 * @return array
230 */
231 public static function indices($localize = TRUE) {
232 $indices = [];
233 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
234 }
235
236 }