Merge pull request #17719 from civicrm/5.27
[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
449c4e6b 9 * (GenCodeChecksum:becab4023b8e0c9d10b2081b7002467d)
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
449c4e6b
CW
130 /**
131 * Returns localized title of this entity.
132 */
133 public static function getEntityTitle() {
134 return ts('Membership Blocks');
135 }
136
e501603b 137 /**
f41f0342 138 * Returns foreign keys and entity references.
e501603b
TO
139 *
140 * @return array
141 * [CRM_Core_Reference_Interface]
142 */
c3fc2621 143 public static function getReferenceColumns() {
346aaaba 144 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 145 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
146 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'entity_id', 'civicrm_contribution_page', 'id');
147 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_default', 'civicrm_membership_type', 'id');
346aaaba 148 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 149 }
346aaaba 150 return Civi::$statics[__CLASS__]['links'];
e501603b 151 }
c3fc2621 152
e501603b
TO
153 /**
154 * Returns all the column names of this table
155 *
156 * @return array
157 */
c3fc2621 158 public static function &fields() {
346aaaba 159 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
160 Civi::$statics[__CLASS__]['fields'] = [
161 'id' => [
e501603b
TO
162 'name' => 'id',
163 'type' => CRM_Utils_Type::T_INT,
c3fc2621 164 'title' => ts('Membership Block ID'),
215b423e 165 'description' => ts('Membership Id'),
c3fc2621 166 'required' => TRUE,
a36434b9 167 'where' => 'civicrm_membership_block.id',
522a26c9 168 'table_name' => 'civicrm_membership_block',
169 'entity' => 'MembershipBlock',
170 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 171 'localizable' => 0,
c3fc2621
CW
172 ],
173 'entity_table' => [
e501603b
TO
174 'name' => 'entity_table',
175 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 176 'title' => ts('Membership Block Entity Table'),
215b423e 177 'description' => ts('Name for Membership Status'),
e501603b
TO
178 'maxlength' => 64,
179 'size' => CRM_Utils_Type::BIG,
a36434b9 180 'where' => 'civicrm_membership_block.entity_table',
522a26c9 181 'table_name' => 'civicrm_membership_block',
182 'entity' => 'MembershipBlock',
183 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 184 'localizable' => 0,
c3fc2621
CW
185 ],
186 'entity_id' => [
e501603b
TO
187 'name' => 'entity_id',
188 'type' => CRM_Utils_Type::T_INT,
c3fc2621 189 'title' => ts('Membership Block Entity ID'),
215b423e 190 'description' => ts('FK to civicrm_contribution_page.id'),
c3fc2621 191 'required' => TRUE,
a36434b9 192 'where' => 'civicrm_membership_block.entity_id',
522a26c9 193 'table_name' => 'civicrm_membership_block',
194 'entity' => 'MembershipBlock',
195 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 196 'localizable' => 0,
e501603b 197 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
c3fc2621
CW
198 ],
199 'membership_types' => [
e501603b
TO
200 'name' => 'membership_types',
201 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 202 'title' => ts('Membership Block Membership Types'),
215b423e 203 'description' => ts('Membership types to be exposed by this block'),
e501603b
TO
204 'maxlength' => 1024,
205 'size' => CRM_Utils_Type::HUGE,
a36434b9 206 'where' => 'civicrm_membership_block.membership_types',
522a26c9 207 'table_name' => 'civicrm_membership_block',
208 'entity' => 'MembershipBlock',
209 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 210 'localizable' => 0,
2a5c9b4d 211 'serialize' => self::SERIALIZE_PHP,
c3fc2621
CW
212 ],
213 'membership_type_default' => [
e501603b
TO
214 'name' => 'membership_type_default',
215 'type' => CRM_Utils_Type::T_INT,
c3fc2621 216 'title' => ts('Membership Block Default Type'),
215b423e 217 'description' => ts('Optional foreign key to membership_type'),
a36434b9 218 'where' => 'civicrm_membership_block.membership_type_default',
522a26c9 219 'table_name' => 'civicrm_membership_block',
220 'entity' => 'MembershipBlock',
221 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 222 'localizable' => 0,
e501603b 223 'FKClassName' => 'CRM_Member_DAO_MembershipType',
c3fc2621
CW
224 ],
225 'display_min_fee' => [
e501603b
TO
226 'name' => 'display_min_fee',
227 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 228 'title' => ts('Membership Block Display Minimum Fee'),
215b423e 229 'description' => ts('Display minimum membership fee'),
a36434b9 230 'where' => 'civicrm_membership_block.display_min_fee',
e501603b 231 'default' => '1',
522a26c9 232 'table_name' => 'civicrm_membership_block',
233 'entity' => 'MembershipBlock',
234 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 235 'localizable' => 0,
c3fc2621
CW
236 ],
237 'is_separate_payment' => [
e501603b
TO
238 'name' => 'is_separate_payment',
239 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 240 'title' => ts('Membership Block Is Separate Payment'),
215b423e 241 'description' => ts('Should membership transactions be processed separately'),
a36434b9 242 'where' => 'civicrm_membership_block.is_separate_payment',
e501603b 243 'default' => '1',
522a26c9 244 'table_name' => 'civicrm_membership_block',
245 'entity' => 'MembershipBlock',
246 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 247 'localizable' => 0,
c3fc2621
CW
248 ],
249 'new_title' => [
e501603b
TO
250 'name' => 'new_title',
251 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 252 'title' => ts('Membership Block New Title'),
215b423e 253 'description' => ts('Title to display at top of block'),
e501603b
TO
254 'maxlength' => 255,
255 'size' => CRM_Utils_Type::HUGE,
a36434b9 256 'where' => 'civicrm_membership_block.new_title',
522a26c9 257 'table_name' => 'civicrm_membership_block',
258 'entity' => 'MembershipBlock',
259 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 260 'localizable' => 1,
c3fc2621
CW
261 ],
262 'new_text' => [
e501603b
TO
263 'name' => 'new_text',
264 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 265 'title' => ts('Membership Block New Text'),
215b423e 266 'description' => ts('Text to display below title'),
a36434b9 267 'where' => 'civicrm_membership_block.new_text',
522a26c9 268 'table_name' => 'civicrm_membership_block',
269 'entity' => 'MembershipBlock',
270 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 271 'localizable' => 1,
c3fc2621
CW
272 ],
273 'renewal_title' => [
e501603b
TO
274 'name' => 'renewal_title',
275 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 276 'title' => ts('Membership Block Renewal Title'),
215b423e 277 'description' => ts('Title for renewal'),
e501603b
TO
278 'maxlength' => 255,
279 'size' => CRM_Utils_Type::HUGE,
a36434b9 280 'where' => 'civicrm_membership_block.renewal_title',
522a26c9 281 'table_name' => 'civicrm_membership_block',
282 'entity' => 'MembershipBlock',
283 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 284 'localizable' => 1,
c3fc2621
CW
285 ],
286 'renewal_text' => [
e501603b
TO
287 'name' => 'renewal_text',
288 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 289 'title' => ts('Membership Block Renewal Text'),
215b423e 290 'description' => ts('Text to display for member renewal'),
a36434b9 291 'where' => 'civicrm_membership_block.renewal_text',
522a26c9 292 'table_name' => 'civicrm_membership_block',
293 'entity' => 'MembershipBlock',
294 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 295 'localizable' => 1,
c3fc2621
CW
296 ],
297 'is_required' => [
e501603b
TO
298 'name' => 'is_required',
299 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 300 'title' => ts('Is Required'),
215b423e 301 'description' => ts('Is membership sign up optional'),
a36434b9 302 'where' => 'civicrm_membership_block.is_required',
45a83e42 303 'default' => '0',
522a26c9 304 'table_name' => 'civicrm_membership_block',
305 'entity' => 'MembershipBlock',
306 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 307 'localizable' => 0,
c3fc2621
CW
308 ],
309 'is_active' => [
e501603b
TO
310 'name' => 'is_active',
311 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 312 'title' => ts('Is Active'),
215b423e 313 'description' => ts('Is this membership_block enabled'),
a36434b9 314 'where' => 'civicrm_membership_block.is_active',
e501603b 315 'default' => '1',
522a26c9 316 'table_name' => 'civicrm_membership_block',
317 'entity' => 'MembershipBlock',
318 'bao' => 'CRM_Member_BAO_MembershipBlock',
6a7e5e5d 319 'localizable' => 0,
c3fc2621
CW
320 ],
321 ];
346aaaba 322 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 323 }
346aaaba 324 return Civi::$statics[__CLASS__]['fields'];
e501603b 325 }
c3fc2621 326
e501603b 327 /**
bd8e0b14 328 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
329 *
330 * @return array
bd8e0b14 331 * Array(string $name => string $uniqueName).
e501603b 332 */
c3fc2621 333 public static function &fieldKeys() {
bd8e0b14
TO
334 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
335 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 336 }
bd8e0b14 337 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 338 }
c3fc2621 339
e501603b
TO
340 /**
341 * Returns the names of this table
342 *
343 * @return string
344 */
c3fc2621 345 public static function getTableName() {
e501603b
TO
346 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
347 }
c3fc2621 348
e501603b
TO
349 /**
350 * Returns if this table needs to be logged
351 *
c3fc2621 352 * @return bool
e501603b 353 */
c3fc2621 354 public function getLog() {
e501603b
TO
355 return self::$_log;
356 }
c3fc2621 357
e501603b
TO
358 /**
359 * Returns the list of fields that can be imported
360 *
361 * @param bool $prefix
362 *
363 * @return array
364 */
c3fc2621
CW
365 public static function &import($prefix = FALSE) {
366 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_block', $prefix, []);
60808919 367 return $r;
e501603b 368 }
c3fc2621 369
e501603b
TO
370 /**
371 * Returns the list of fields that can be exported
372 *
373 * @param bool $prefix
374 *
375 * @return array
376 */
c3fc2621
CW
377 public static function &export($prefix = FALSE) {
378 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_block', $prefix, []);
60808919 379 return $r;
e501603b 380 }
c3fc2621 381
e7a6b91a
AS
382 /**
383 * Returns the list of indices
c3fc2621
CW
384 *
385 * @param bool $localize
386 *
387 * @return array
e7a6b91a
AS
388 */
389 public static function indices($localize = TRUE) {
c3fc2621 390 $indices = [];
e7a6b91a
AS
391 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
392 }
c3fc2621 393
e501603b 394}