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