5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Member/MembershipBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:b8779f341fdb53bc75c0928fea73f06f)
13 * Database access object for the MembershipBlock entity.
15 class CRM_Member_DAO_MembershipBlock
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.5';
18 const COMPONENT
= 'CiviMember';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_membership_block';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
37 * @var int|string|null
38 * (SQL type: int unsigned)
39 * Note that values will be retrieved from the database as a string.
44 * Name for Membership Status
47 * (SQL type: varchar(64))
48 * Note that values will be retrieved from the database as a string.
53 * FK to civicrm_contribution_page.id
56 * (SQL type: int unsigned)
57 * Note that values will be retrieved from the database as a string.
62 * Membership types to be exposed by this block
65 * (SQL type: varchar(1024))
66 * Note that values will be retrieved from the database as a string.
68 public $membership_types;
71 * Optional foreign key to membership_type
73 * @var int|string|null
74 * (SQL type: int unsigned)
75 * Note that values will be retrieved from the database as a string.
77 public $membership_type_default;
80 * Display minimum membership fee
84 * Note that values will be retrieved from the database as a string.
86 public $display_min_fee;
89 * Should membership transactions be processed separately
93 * Note that values will be retrieved from the database as a string.
95 public $is_separate_payment;
98 * Title to display at top of block
101 * (SQL type: varchar(255))
102 * Note that values will be retrieved from the database as a string.
107 * Text to display below title
111 * Note that values will be retrieved from the database as a string.
119 * (SQL type: varchar(255))
120 * Note that values will be retrieved from the database as a string.
122 public $renewal_title;
125 * Text to display for member renewal
129 * Note that values will be retrieved from the database as a string.
131 public $renewal_text;
134 * Is membership sign up optional
137 * (SQL type: tinyint)
138 * Note that values will be retrieved from the database as a string.
143 * Is this membership_block enabled
146 * (SQL type: tinyint)
147 * Note that values will be retrieved from the database as a string.
154 public function __construct() {
155 $this->__table
= 'civicrm_membership_block';
156 parent
::__construct();
160 * Returns localized title of this entity.
162 * @param bool $plural
163 * Whether to return the plural version of the title.
165 public static function getEntityTitle($plural = FALSE) {
166 return $plural ?
ts('Membership Blocks') : ts('Membership Block');
170 * Returns foreign keys and entity references.
173 * [CRM_Core_Reference_Interface]
175 public static function getReferenceColumns() {
176 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
177 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
178 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'entity_id', 'civicrm_contribution_page', 'id');
179 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'membership_type_default', 'civicrm_membership_type', 'id');
180 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
182 return Civi
::$statics[__CLASS__
]['links'];
186 * Returns all the column names of this table
190 public static function &fields() {
191 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
192 Civi
::$statics[__CLASS__
]['fields'] = [
195 'type' => CRM_Utils_Type
::T_INT
,
196 'title' => ts('Membership Block ID'),
197 'description' => ts('Membership ID'),
199 'where' => 'civicrm_membership_block.id',
200 'table_name' => 'civicrm_membership_block',
201 'entity' => 'MembershipBlock',
202 'bao' => 'CRM_Member_BAO_MembershipBlock',
211 'name' => 'entity_table',
212 'type' => CRM_Utils_Type
::T_STRING
,
213 'title' => ts('Membership Block Entity Table'),
214 'description' => ts('Name for Membership Status'),
216 'size' => CRM_Utils_Type
::BIG
,
217 'where' => 'civicrm_membership_block.entity_table',
218 'table_name' => 'civicrm_membership_block',
219 'entity' => 'MembershipBlock',
220 'bao' => 'CRM_Member_BAO_MembershipBlock',
225 'name' => 'entity_id',
226 'type' => CRM_Utils_Type
::T_INT
,
227 'title' => ts('Entity ID'),
228 'description' => ts('FK to civicrm_contribution_page.id'),
230 'where' => 'civicrm_membership_block.entity_id',
231 'table_name' => 'civicrm_membership_block',
232 'entity' => 'MembershipBlock',
233 'bao' => 'CRM_Member_BAO_MembershipBlock',
235 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
237 'label' => ts("Entity"),
241 'membership_types' => [
242 'name' => 'membership_types',
243 'type' => CRM_Utils_Type
::T_STRING
,
244 'title' => ts('Membership Block Membership Types'),
245 'description' => ts('Membership types to be exposed by this block'),
247 'size' => CRM_Utils_Type
::HUGE
,
248 'where' => 'civicrm_membership_block.membership_types',
249 'table_name' => 'civicrm_membership_block',
250 'entity' => 'MembershipBlock',
251 'bao' => 'CRM_Member_BAO_MembershipBlock',
253 'serialize' => self
::SERIALIZE_PHP
,
256 'membership_type_default' => [
257 'name' => 'membership_type_default',
258 'type' => CRM_Utils_Type
::T_INT
,
259 'title' => ts('Default Type ID'),
260 'description' => ts('Optional foreign key to membership_type'),
261 'where' => 'civicrm_membership_block.membership_type_default',
262 'table_name' => 'civicrm_membership_block',
263 'entity' => 'MembershipBlock',
264 'bao' => 'CRM_Member_BAO_MembershipBlock',
266 'FKClassName' => 'CRM_Member_DAO_MembershipType',
268 'label' => ts("Default Type"),
272 'display_min_fee' => [
273 'name' => 'display_min_fee',
274 'type' => CRM_Utils_Type
::T_BOOLEAN
,
275 'title' => ts('Membership Block Display Minimum Fee'),
276 'description' => ts('Display minimum membership fee'),
278 'where' => 'civicrm_membership_block.display_min_fee',
280 'table_name' => 'civicrm_membership_block',
281 'entity' => 'MembershipBlock',
282 'bao' => 'CRM_Member_BAO_MembershipBlock',
286 'is_separate_payment' => [
287 'name' => 'is_separate_payment',
288 'type' => CRM_Utils_Type
::T_BOOLEAN
,
289 'title' => ts('Membership Block Is Separate Payment'),
290 'description' => ts('Should membership transactions be processed separately'),
292 'where' => 'civicrm_membership_block.is_separate_payment',
294 'table_name' => 'civicrm_membership_block',
295 'entity' => 'MembershipBlock',
296 'bao' => 'CRM_Member_BAO_MembershipBlock',
301 'name' => 'new_title',
302 'type' => CRM_Utils_Type
::T_STRING
,
303 'title' => ts('Membership Block New Title'),
304 'description' => ts('Title to display at top of block'),
306 'size' => CRM_Utils_Type
::HUGE
,
307 'where' => 'civicrm_membership_block.new_title',
308 'table_name' => 'civicrm_membership_block',
309 'entity' => 'MembershipBlock',
310 'bao' => 'CRM_Member_BAO_MembershipBlock',
315 'name' => 'new_text',
316 'type' => CRM_Utils_Type
::T_TEXT
,
317 'title' => ts('Membership Block New Text'),
318 'description' => ts('Text to display below title'),
319 'where' => 'civicrm_membership_block.new_text',
320 'table_name' => 'civicrm_membership_block',
321 'entity' => 'MembershipBlock',
322 'bao' => 'CRM_Member_BAO_MembershipBlock',
327 'name' => 'renewal_title',
328 'type' => CRM_Utils_Type
::T_STRING
,
329 'title' => ts('Membership Block Renewal Title'),
330 'description' => ts('Title for renewal'),
332 'size' => CRM_Utils_Type
::HUGE
,
333 'where' => 'civicrm_membership_block.renewal_title',
334 'table_name' => 'civicrm_membership_block',
335 'entity' => 'MembershipBlock',
336 'bao' => 'CRM_Member_BAO_MembershipBlock',
341 'name' => 'renewal_text',
342 'type' => CRM_Utils_Type
::T_TEXT
,
343 'title' => ts('Membership Block Renewal Text'),
344 'description' => ts('Text to display for member renewal'),
345 'where' => 'civicrm_membership_block.renewal_text',
346 'table_name' => 'civicrm_membership_block',
347 'entity' => 'MembershipBlock',
348 'bao' => 'CRM_Member_BAO_MembershipBlock',
353 'name' => 'is_required',
354 'type' => CRM_Utils_Type
::T_BOOLEAN
,
355 'title' => ts('Is Required'),
356 'description' => ts('Is membership sign up optional'),
358 'where' => 'civicrm_membership_block.is_required',
360 'table_name' => 'civicrm_membership_block',
361 'entity' => 'MembershipBlock',
362 'bao' => 'CRM_Member_BAO_MembershipBlock',
367 'name' => 'is_active',
368 'type' => CRM_Utils_Type
::T_BOOLEAN
,
369 'title' => ts('Is Active'),
370 'description' => ts('Is this membership_block enabled'),
372 'where' => 'civicrm_membership_block.is_active',
374 'table_name' => 'civicrm_membership_block',
375 'entity' => 'MembershipBlock',
376 'bao' => 'CRM_Member_BAO_MembershipBlock',
381 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
383 return Civi
::$statics[__CLASS__
]['fields'];
387 * Return a mapping from field-name to the corresponding key (as used in fields()).
390 * Array(string $name => string $uniqueName).
392 public static function &fieldKeys() {
393 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
394 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
396 return Civi
::$statics[__CLASS__
]['fieldKeys'];
400 * Returns the names of this table
404 public static function getTableName() {
405 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
409 * Returns if this table needs to be logged
413 public function getLog() {
418 * Returns the list of fields that can be imported
420 * @param bool $prefix
424 public static function &import($prefix = FALSE) {
425 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_block', $prefix, []);
430 * Returns the list of fields that can be exported
432 * @param bool $prefix
436 public static function &export($prefix = FALSE) {
437 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_block', $prefix, []);
442 * Returns the list of indices
444 * @param bool $localize
448 public static function indices($localize = TRUE) {
450 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;