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