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