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:8e0e93f6f480d279cbf4ac53db86a8f3)
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
82 * @var bool|string|null
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
91 * @var bool|string|null
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
136 * @var bool|string|null
137 * (SQL type: tinyint)
138 * Note that values will be retrieved from the database as a string.
143 * Is this membership_block enabled
145 * @var bool|string|null
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'),
277 'where' => 'civicrm_membership_block.display_min_fee',
279 'table_name' => 'civicrm_membership_block',
280 'entity' => 'MembershipBlock',
281 'bao' => 'CRM_Member_BAO_MembershipBlock',
285 'is_separate_payment' => [
286 'name' => 'is_separate_payment',
287 'type' => CRM_Utils_Type
::T_BOOLEAN
,
288 'title' => ts('Membership Block Is Separate Payment'),
289 'description' => ts('Should membership transactions be processed separately'),
290 'where' => 'civicrm_membership_block.is_separate_payment',
292 'table_name' => 'civicrm_membership_block',
293 'entity' => 'MembershipBlock',
294 'bao' => 'CRM_Member_BAO_MembershipBlock',
299 'name' => 'new_title',
300 'type' => CRM_Utils_Type
::T_STRING
,
301 'title' => ts('Membership Block New Title'),
302 'description' => ts('Title to display at top of block'),
304 'size' => CRM_Utils_Type
::HUGE
,
305 'where' => 'civicrm_membership_block.new_title',
306 'table_name' => 'civicrm_membership_block',
307 'entity' => 'MembershipBlock',
308 'bao' => 'CRM_Member_BAO_MembershipBlock',
313 'name' => 'new_text',
314 'type' => CRM_Utils_Type
::T_TEXT
,
315 'title' => ts('Membership Block New Text'),
316 'description' => ts('Text to display below title'),
317 'where' => 'civicrm_membership_block.new_text',
318 'table_name' => 'civicrm_membership_block',
319 'entity' => 'MembershipBlock',
320 'bao' => 'CRM_Member_BAO_MembershipBlock',
325 'name' => 'renewal_title',
326 'type' => CRM_Utils_Type
::T_STRING
,
327 'title' => ts('Membership Block Renewal Title'),
328 'description' => ts('Title for renewal'),
330 'size' => CRM_Utils_Type
::HUGE
,
331 'where' => 'civicrm_membership_block.renewal_title',
332 'table_name' => 'civicrm_membership_block',
333 'entity' => 'MembershipBlock',
334 'bao' => 'CRM_Member_BAO_MembershipBlock',
339 'name' => 'renewal_text',
340 'type' => CRM_Utils_Type
::T_TEXT
,
341 'title' => ts('Membership Block Renewal Text'),
342 'description' => ts('Text to display for member renewal'),
343 'where' => 'civicrm_membership_block.renewal_text',
344 'table_name' => 'civicrm_membership_block',
345 'entity' => 'MembershipBlock',
346 'bao' => 'CRM_Member_BAO_MembershipBlock',
351 'name' => 'is_required',
352 'type' => CRM_Utils_Type
::T_BOOLEAN
,
353 'title' => ts('Is Required'),
354 'description' => ts('Is membership sign up optional'),
355 'where' => 'civicrm_membership_block.is_required',
357 'table_name' => 'civicrm_membership_block',
358 'entity' => 'MembershipBlock',
359 'bao' => 'CRM_Member_BAO_MembershipBlock',
364 'name' => 'is_active',
365 'type' => CRM_Utils_Type
::T_BOOLEAN
,
366 'title' => ts('Is Active'),
367 'description' => ts('Is this membership_block enabled'),
368 'where' => 'civicrm_membership_block.is_active',
370 'table_name' => 'civicrm_membership_block',
371 'entity' => 'MembershipBlock',
372 'bao' => 'CRM_Member_BAO_MembershipBlock',
377 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
379 return Civi
::$statics[__CLASS__
]['fields'];
383 * Return a mapping from field-name to the corresponding key (as used in fields()).
386 * Array(string $name => string $uniqueName).
388 public static function &fieldKeys() {
389 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
390 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
392 return Civi
::$statics[__CLASS__
]['fieldKeys'];
396 * Returns the names of this table
400 public static function getTableName() {
401 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
405 * Returns if this table needs to be logged
409 public function getLog() {
414 * Returns the list of fields that can be imported
416 * @param bool $prefix
420 public static function &import($prefix = FALSE) {
421 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_block', $prefix, []);
426 * Returns the list of fields that can be exported
428 * @param bool $prefix
432 public static function &export($prefix = FALSE) {
433 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_block', $prefix, []);
438 * Returns the list of indices
440 * @param bool $localize
444 public static function indices($localize = TRUE) {
446 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;