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