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