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