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