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:687b0ecc1e487ede5c4c5719da6e3909)
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',
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'),
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',
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'),
200 'where' => 'civicrm_membership_block.entity_id',
201 'table_name' => 'civicrm_membership_block',
202 'entity' => 'MembershipBlock',
203 'bao' => 'CRM_Member_BAO_MembershipBlock',
205 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
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'),
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',
220 'serialize' => self
::SERIALIZE_PHP
,
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',
233 'FKClassName' => 'CRM_Member_DAO_MembershipType',
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',
243 'table_name' => 'civicrm_membership_block',
244 'entity' => 'MembershipBlock',
245 'bao' => 'CRM_Member_BAO_MembershipBlock',
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',
256 'table_name' => 'civicrm_membership_block',
257 'entity' => 'MembershipBlock',
258 'bao' => 'CRM_Member_BAO_MembershipBlock',
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'),
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',
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',
289 'name' => 'renewal_title',
290 'type' => CRM_Utils_Type
::T_STRING
,
291 'title' => ts('Membership Block Renewal Title'),
292 'description' => ts('Title for renewal'),
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',
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',
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',
321 'table_name' => 'civicrm_membership_block',
322 'entity' => 'MembershipBlock',
323 'bao' => 'CRM_Member_BAO_MembershipBlock',
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',
334 'table_name' => 'civicrm_membership_block',
335 'entity' => 'MembershipBlock',
336 'bao' => 'CRM_Member_BAO_MembershipBlock',
341 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
343 return Civi
::$statics[__CLASS__
]['fields'];
347 * Return a mapping from field-name to the corresponding key (as used in fields()).
350 * Array(string $name => string $uniqueName).
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()));
356 return Civi
::$statics[__CLASS__
]['fieldKeys'];
360 * Returns the names of this table
364 public static function getTableName() {
365 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
369 * Returns if this table needs to be logged
373 public function getLog() {
378 * Returns the list of fields that can be imported
380 * @param bool $prefix
384 public static function &import($prefix = FALSE) {
385 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_block', $prefix, []);
390 * Returns the list of fields that can be exported
392 * @param bool $prefix
396 public static function &export($prefix = FALSE) {
397 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_block', $prefix, []);
402 * Returns the list of indices
404 * @param bool $localize
408 public static function indices($localize = TRUE) {
410 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;