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