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