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:4507d044332c623e6da4979516fef906)
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;
42 * Name for Membership Status
49 * FK to civicrm_contribution_page.id
56 * Membership types to be exposed by this block
60 public $membership_types;
63 * Optional foreign key to membership_type
67 public $membership_type_default;
70 * Display minimum membership fee
74 public $display_min_fee;
77 * Should membership transactions be processed separately
81 public $is_separate_payment;
84 * Title to display at top of block
91 * Text to display below title
102 public $renewal_title;
105 * Text to display for member renewal
109 public $renewal_text;
112 * Is membership sign up optional
119 * Is this membership_block enabled
128 public function __construct() {
129 $this->__table
= 'civicrm_membership_block';
130 parent
::__construct();
134 * Returns localized title of this entity.
136 * @param bool $plural
137 * Whether to return the plural version of the title.
139 public static function getEntityTitle($plural = FALSE) {
140 return $plural ?
ts('Membership Blocks') : ts('Membership Block');
144 * Returns foreign keys and entity references.
147 * [CRM_Core_Reference_Interface]
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']);
156 return Civi
::$statics[__CLASS__
]['links'];
160 * Returns all the column names of this table
164 public static function &fields() {
165 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
166 Civi
::$statics[__CLASS__
]['fields'] = [
169 'type' => CRM_Utils_Type
::T_INT
,
170 'title' => ts('Membership Block ID'),
171 'description' => ts('Membership ID'),
173 'where' => 'civicrm_membership_block.id',
174 'table_name' => 'civicrm_membership_block',
175 'entity' => 'MembershipBlock',
176 'bao' => 'CRM_Member_BAO_MembershipBlock',
184 'name' => 'entity_table',
185 'type' => CRM_Utils_Type
::T_STRING
,
186 'title' => ts('Membership Block Entity Table'),
187 'description' => ts('Name for Membership Status'),
189 'size' => CRM_Utils_Type
::BIG
,
190 'where' => 'civicrm_membership_block.entity_table',
191 'table_name' => 'civicrm_membership_block',
192 'entity' => 'MembershipBlock',
193 'bao' => 'CRM_Member_BAO_MembershipBlock',
198 'name' => 'entity_id',
199 'type' => CRM_Utils_Type
::T_INT
,
200 'title' => ts('Entity ID'),
201 'description' => ts('FK to civicrm_contribution_page.id'),
203 'where' => 'civicrm_membership_block.entity_id',
204 'table_name' => 'civicrm_membership_block',
205 'entity' => 'MembershipBlock',
206 'bao' => 'CRM_Member_BAO_MembershipBlock',
208 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
210 'label' => ts("Entity"),
214 'membership_types' => [
215 'name' => 'membership_types',
216 'type' => CRM_Utils_Type
::T_STRING
,
217 'title' => ts('Membership Block Membership Types'),
218 'description' => ts('Membership types to be exposed by this block'),
220 'size' => CRM_Utils_Type
::HUGE
,
221 'where' => 'civicrm_membership_block.membership_types',
222 'table_name' => 'civicrm_membership_block',
223 'entity' => 'MembershipBlock',
224 'bao' => 'CRM_Member_BAO_MembershipBlock',
226 'serialize' => self
::SERIALIZE_PHP
,
229 'membership_type_default' => [
230 'name' => 'membership_type_default',
231 'type' => CRM_Utils_Type
::T_INT
,
232 'title' => ts('Default Type ID'),
233 'description' => ts('Optional foreign key to membership_type'),
234 'where' => 'civicrm_membership_block.membership_type_default',
235 'table_name' => 'civicrm_membership_block',
236 'entity' => 'MembershipBlock',
237 'bao' => 'CRM_Member_BAO_MembershipBlock',
239 'FKClassName' => 'CRM_Member_DAO_MembershipType',
241 'label' => ts("Default Type"),
245 'display_min_fee' => [
246 'name' => 'display_min_fee',
247 'type' => CRM_Utils_Type
::T_BOOLEAN
,
248 'title' => ts('Membership Block Display Minimum Fee'),
249 'description' => ts('Display minimum membership fee'),
250 'where' => 'civicrm_membership_block.display_min_fee',
252 'table_name' => 'civicrm_membership_block',
253 'entity' => 'MembershipBlock',
254 'bao' => 'CRM_Member_BAO_MembershipBlock',
258 'is_separate_payment' => [
259 'name' => 'is_separate_payment',
260 'type' => CRM_Utils_Type
::T_BOOLEAN
,
261 'title' => ts('Membership Block Is Separate Payment'),
262 'description' => ts('Should membership transactions be processed separately'),
263 'where' => 'civicrm_membership_block.is_separate_payment',
265 'table_name' => 'civicrm_membership_block',
266 'entity' => 'MembershipBlock',
267 'bao' => 'CRM_Member_BAO_MembershipBlock',
272 'name' => 'new_title',
273 'type' => CRM_Utils_Type
::T_STRING
,
274 'title' => ts('Membership Block New Title'),
275 'description' => ts('Title to display at top of block'),
277 'size' => CRM_Utils_Type
::HUGE
,
278 'where' => 'civicrm_membership_block.new_title',
279 'table_name' => 'civicrm_membership_block',
280 'entity' => 'MembershipBlock',
281 'bao' => 'CRM_Member_BAO_MembershipBlock',
286 'name' => 'new_text',
287 'type' => CRM_Utils_Type
::T_TEXT
,
288 'title' => ts('Membership Block New Text'),
289 'description' => ts('Text to display below title'),
290 'where' => 'civicrm_membership_block.new_text',
291 'table_name' => 'civicrm_membership_block',
292 'entity' => 'MembershipBlock',
293 'bao' => 'CRM_Member_BAO_MembershipBlock',
298 'name' => 'renewal_title',
299 'type' => CRM_Utils_Type
::T_STRING
,
300 'title' => ts('Membership Block Renewal Title'),
301 'description' => ts('Title for renewal'),
303 'size' => CRM_Utils_Type
::HUGE
,
304 'where' => 'civicrm_membership_block.renewal_title',
305 'table_name' => 'civicrm_membership_block',
306 'entity' => 'MembershipBlock',
307 'bao' => 'CRM_Member_BAO_MembershipBlock',
312 'name' => 'renewal_text',
313 'type' => CRM_Utils_Type
::T_TEXT
,
314 'title' => ts('Membership Block Renewal Text'),
315 'description' => ts('Text to display for member renewal'),
316 'where' => 'civicrm_membership_block.renewal_text',
317 'table_name' => 'civicrm_membership_block',
318 'entity' => 'MembershipBlock',
319 'bao' => 'CRM_Member_BAO_MembershipBlock',
324 'name' => 'is_required',
325 'type' => CRM_Utils_Type
::T_BOOLEAN
,
326 'title' => ts('Is Required'),
327 'description' => ts('Is membership sign up optional'),
328 'where' => 'civicrm_membership_block.is_required',
330 'table_name' => 'civicrm_membership_block',
331 'entity' => 'MembershipBlock',
332 'bao' => 'CRM_Member_BAO_MembershipBlock',
337 'name' => 'is_active',
338 'type' => CRM_Utils_Type
::T_BOOLEAN
,
339 'title' => ts('Is Active'),
340 'description' => ts('Is this membership_block enabled'),
341 'where' => 'civicrm_membership_block.is_active',
343 'table_name' => 'civicrm_membership_block',
344 'entity' => 'MembershipBlock',
345 'bao' => 'CRM_Member_BAO_MembershipBlock',
350 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
352 return Civi
::$statics[__CLASS__
]['fields'];
356 * Return a mapping from field-name to the corresponding key (as used in fields()).
359 * Array(string $name => string $uniqueName).
361 public static function &fieldKeys() {
362 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
363 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
365 return Civi
::$statics[__CLASS__
]['fieldKeys'];
369 * Returns the names of this table
373 public static function getTableName() {
374 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
378 * Returns if this table needs to be logged
382 public function getLog() {
387 * Returns the list of fields that can be imported
389 * @param bool $prefix
393 public static function &import($prefix = FALSE) {
394 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_block', $prefix, []);
399 * Returns the list of fields that can be exported
401 * @param bool $prefix
405 public static function &export($prefix = FALSE) {
406 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_block', $prefix, []);
411 * Returns the list of indices
413 * @param bool $localize
417 public static function indices($localize = TRUE) {
419 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;