Merge branch '5.11' of https://github.com/civicrm/civicrm-core
[civicrm-core.git] / CRM / Member / DAO / MembershipBlock.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Member/MembershipBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:00a04451a5cee7da1ae6a4c255f40481)
10 */
11
12 /**
13 * Database access object for the MembershipBlock entity.
14 */
15 class CRM_Member_DAO_MembershipBlock extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_membership_block';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 static $_log = TRUE;
30
31 /**
32 * Membership Id
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Name for Membership Status
40 *
41 * @var string
42 */
43 public $entity_table;
44
45 /**
46 * FK to civicrm_contribution_page.id
47 *
48 * @var int unsigned
49 */
50 public $entity_id;
51
52 /**
53 * Membership types to be exposed by this block
54 *
55 * @var string
56 */
57 public $membership_types;
58
59 /**
60 * Optional foreign key to membership_type
61 *
62 * @var int unsigned
63 */
64 public $membership_type_default;
65
66 /**
67 * Display minimum membership fee
68 *
69 * @var boolean
70 */
71 public $display_min_fee;
72
73 /**
74 * Should membership transactions be processed separately
75 *
76 * @var boolean
77 */
78 public $is_separate_payment;
79
80 /**
81 * Title to display at top of block
82 *
83 * @var string
84 */
85 public $new_title;
86
87 /**
88 * Text to display below title
89 *
90 * @var text
91 */
92 public $new_text;
93
94 /**
95 * Title for renewal
96 *
97 * @var string
98 */
99 public $renewal_title;
100
101 /**
102 * Text to display for member renewal
103 *
104 * @var text
105 */
106 public $renewal_text;
107
108 /**
109 * Is membership sign up optional
110 *
111 * @var boolean
112 */
113 public $is_required;
114
115 /**
116 * Is this membership_block enabled
117 *
118 * @var boolean
119 */
120 public $is_active;
121
122 /**
123 * Class constructor.
124 */
125 public function __construct() {
126 $this->__table = 'civicrm_membership_block';
127 parent::__construct();
128 }
129
130 /**
131 * Returns foreign keys and entity references.
132 *
133 * @return array
134 * [CRM_Core_Reference_Interface]
135 */
136 public static function getReferenceColumns() {
137 if (!isset(Civi::$statics[__CLASS__]['links'])) {
138 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
139 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'entity_id', 'civicrm_contribution_page', 'id');
140 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_default', 'civicrm_membership_type', 'id');
141 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
142 }
143 return Civi::$statics[__CLASS__]['links'];
144 }
145
146 /**
147 * Returns all the column names of this table
148 *
149 * @return array
150 */
151 public static function &fields() {
152 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
153 Civi::$statics[__CLASS__]['fields'] = [
154 'id' => [
155 'name' => 'id',
156 'type' => CRM_Utils_Type::T_INT,
157 'title' => ts('Membership Block ID'),
158 'description' => ts('Membership Id'),
159 'required' => TRUE,
160 'table_name' => 'civicrm_membership_block',
161 'entity' => 'MembershipBlock',
162 'bao' => 'CRM_Member_BAO_MembershipBlock',
163 'localizable' => 0,
164 ],
165 'entity_table' => [
166 'name' => 'entity_table',
167 'type' => CRM_Utils_Type::T_STRING,
168 'title' => ts('Membership Block Entity Table'),
169 'description' => ts('Name for Membership Status'),
170 'maxlength' => 64,
171 'size' => CRM_Utils_Type::BIG,
172 'table_name' => 'civicrm_membership_block',
173 'entity' => 'MembershipBlock',
174 'bao' => 'CRM_Member_BAO_MembershipBlock',
175 'localizable' => 0,
176 ],
177 'entity_id' => [
178 'name' => 'entity_id',
179 'type' => CRM_Utils_Type::T_INT,
180 'title' => ts('Membership Block Entity ID'),
181 'description' => ts('FK to civicrm_contribution_page.id'),
182 'required' => TRUE,
183 'table_name' => 'civicrm_membership_block',
184 'entity' => 'MembershipBlock',
185 'bao' => 'CRM_Member_BAO_MembershipBlock',
186 'localizable' => 0,
187 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
188 ],
189 'membership_types' => [
190 'name' => 'membership_types',
191 'type' => CRM_Utils_Type::T_STRING,
192 'title' => ts('Membership Block Membership Types'),
193 'description' => ts('Membership types to be exposed by this block'),
194 'maxlength' => 1024,
195 'size' => CRM_Utils_Type::HUGE,
196 'table_name' => 'civicrm_membership_block',
197 'entity' => 'MembershipBlock',
198 'bao' => 'CRM_Member_BAO_MembershipBlock',
199 'localizable' => 0,
200 'serialize' => self::SERIALIZE_PHP,
201 ],
202 'membership_type_default' => [
203 'name' => 'membership_type_default',
204 'type' => CRM_Utils_Type::T_INT,
205 'title' => ts('Membership Block Default Type'),
206 'description' => ts('Optional foreign key to membership_type'),
207 'table_name' => 'civicrm_membership_block',
208 'entity' => 'MembershipBlock',
209 'bao' => 'CRM_Member_BAO_MembershipBlock',
210 'localizable' => 0,
211 'FKClassName' => 'CRM_Member_DAO_MembershipType',
212 ],
213 'display_min_fee' => [
214 'name' => 'display_min_fee',
215 'type' => CRM_Utils_Type::T_BOOLEAN,
216 'title' => ts('Membership Block Display Minimum Fee'),
217 'description' => ts('Display minimum membership fee'),
218 'default' => '1',
219 'table_name' => 'civicrm_membership_block',
220 'entity' => 'MembershipBlock',
221 'bao' => 'CRM_Member_BAO_MembershipBlock',
222 'localizable' => 0,
223 ],
224 'is_separate_payment' => [
225 'name' => 'is_separate_payment',
226 'type' => CRM_Utils_Type::T_BOOLEAN,
227 'title' => ts('Membership Block Is Separate Payment'),
228 'description' => ts('Should membership transactions be processed separately'),
229 'default' => '1',
230 'table_name' => 'civicrm_membership_block',
231 'entity' => 'MembershipBlock',
232 'bao' => 'CRM_Member_BAO_MembershipBlock',
233 'localizable' => 0,
234 ],
235 'new_title' => [
236 'name' => 'new_title',
237 'type' => CRM_Utils_Type::T_STRING,
238 'title' => ts('Membership Block New Title'),
239 'description' => ts('Title to display at top of block'),
240 'maxlength' => 255,
241 'size' => CRM_Utils_Type::HUGE,
242 'table_name' => 'civicrm_membership_block',
243 'entity' => 'MembershipBlock',
244 'bao' => 'CRM_Member_BAO_MembershipBlock',
245 'localizable' => 1,
246 ],
247 'new_text' => [
248 'name' => 'new_text',
249 'type' => CRM_Utils_Type::T_TEXT,
250 'title' => ts('Membership Block New Text'),
251 'description' => ts('Text to display below title'),
252 'table_name' => 'civicrm_membership_block',
253 'entity' => 'MembershipBlock',
254 'bao' => 'CRM_Member_BAO_MembershipBlock',
255 'localizable' => 1,
256 ],
257 'renewal_title' => [
258 'name' => 'renewal_title',
259 'type' => CRM_Utils_Type::T_STRING,
260 'title' => ts('Membership Block Renewal Title'),
261 'description' => ts('Title for renewal'),
262 'maxlength' => 255,
263 'size' => CRM_Utils_Type::HUGE,
264 'table_name' => 'civicrm_membership_block',
265 'entity' => 'MembershipBlock',
266 'bao' => 'CRM_Member_BAO_MembershipBlock',
267 'localizable' => 1,
268 ],
269 'renewal_text' => [
270 'name' => 'renewal_text',
271 'type' => CRM_Utils_Type::T_TEXT,
272 'title' => ts('Membership Block Renewal Text'),
273 'description' => ts('Text to display for member renewal'),
274 'table_name' => 'civicrm_membership_block',
275 'entity' => 'MembershipBlock',
276 'bao' => 'CRM_Member_BAO_MembershipBlock',
277 'localizable' => 1,
278 ],
279 'is_required' => [
280 'name' => 'is_required',
281 'type' => CRM_Utils_Type::T_BOOLEAN,
282 'title' => ts('Is Required'),
283 'description' => ts('Is membership sign up optional'),
284 'default' => '0',
285 'table_name' => 'civicrm_membership_block',
286 'entity' => 'MembershipBlock',
287 'bao' => 'CRM_Member_BAO_MembershipBlock',
288 'localizable' => 0,
289 ],
290 'is_active' => [
291 'name' => 'is_active',
292 'type' => CRM_Utils_Type::T_BOOLEAN,
293 'title' => ts('Is Active'),
294 'description' => ts('Is this membership_block enabled'),
295 'default' => '1',
296 'table_name' => 'civicrm_membership_block',
297 'entity' => 'MembershipBlock',
298 'bao' => 'CRM_Member_BAO_MembershipBlock',
299 'localizable' => 0,
300 ],
301 ];
302 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
303 }
304 return Civi::$statics[__CLASS__]['fields'];
305 }
306
307 /**
308 * Return a mapping from field-name to the corresponding key (as used in fields()).
309 *
310 * @return array
311 * Array(string $name => string $uniqueName).
312 */
313 public static function &fieldKeys() {
314 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
315 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
316 }
317 return Civi::$statics[__CLASS__]['fieldKeys'];
318 }
319
320 /**
321 * Returns the names of this table
322 *
323 * @return string
324 */
325 public static function getTableName() {
326 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
327 }
328
329 /**
330 * Returns if this table needs to be logged
331 *
332 * @return bool
333 */
334 public function getLog() {
335 return self::$_log;
336 }
337
338 /**
339 * Returns the list of fields that can be imported
340 *
341 * @param bool $prefix
342 *
343 * @return array
344 */
345 public static function &import($prefix = FALSE) {
346 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_block', $prefix, []);
347 return $r;
348 }
349
350 /**
351 * Returns the list of fields that can be exported
352 *
353 * @param bool $prefix
354 *
355 * @return array
356 */
357 public static function &export($prefix = FALSE) {
358 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_block', $prefix, []);
359 return $r;
360 }
361
362 /**
363 * Returns the list of indices
364 *
365 * @param bool $localize
366 *
367 * @return array
368 */
369 public static function indices($localize = TRUE) {
370 $indices = [];
371 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
372 }
373
374 }