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