Merge pull request #21892 from artfulrobot/artfulrobot-order-membership
[civicrm-core.git] / CRM / Pledge / DAO / PledgeBlock.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Pledge/PledgeBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:37dd1b6ee946c78093489ce7a98c55e0)
10 */
11
12 /**
13 * Database access object for the PledgeBlock entity.
14 */
15 class CRM_Pledge_DAO_PledgeBlock extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.1';
18 const COMPONENT = 'CiviPledge';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_pledge_block';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = TRUE;
33
34 /**
35 * Pledge ID
36 *
37 * @var int
38 */
39 public $id;
40
41 /**
42 * physical tablename for entity being joined to pledge, e.g. civicrm_contact
43 *
44 * @var string
45 */
46 public $entity_table;
47
48 /**
49 * FK to entity table specified in entity_table column.
50 *
51 * @var int
52 */
53 public $entity_id;
54
55 /**
56 * Delimited list of supported frequency units
57 *
58 * @var string
59 */
60 public $pledge_frequency_unit;
61
62 /**
63 * Is frequency interval exposed on the contribution form.
64 *
65 * @var bool
66 */
67 public $is_pledge_interval;
68
69 /**
70 * The maximum number of payment reminders to send for any given payment.
71 *
72 * @var int
73 */
74 public $max_reminders;
75
76 /**
77 * Send initial reminder this many days prior to the payment due date.
78 *
79 * @var int
80 */
81 public $initial_reminder_day;
82
83 /**
84 * Send additional reminder this many days after last one sent, up to maximum number of reminders.
85 *
86 * @var int
87 */
88 public $additional_reminder_day;
89
90 /**
91 * The date the first scheduled pledge occurs.
92 *
93 * @var string
94 */
95 public $pledge_start_date;
96
97 /**
98 * If true - recurring start date is shown.
99 *
100 * @var bool
101 */
102 public $is_pledge_start_date_visible;
103
104 /**
105 * If true - recurring start date is editable.
106 *
107 * @var bool
108 */
109 public $is_pledge_start_date_editable;
110
111 /**
112 * Class constructor.
113 */
114 public function __construct() {
115 $this->__table = 'civicrm_pledge_block';
116 parent::__construct();
117 }
118
119 /**
120 * Returns localized title of this entity.
121 *
122 * @param bool $plural
123 * Whether to return the plural version of the title.
124 */
125 public static function getEntityTitle($plural = FALSE) {
126 return $plural ? ts('Pledge Blocks') : ts('Pledge Block');
127 }
128
129 /**
130 * Returns foreign keys and entity references.
131 *
132 * @return array
133 * [CRM_Core_Reference_Interface]
134 */
135 public static function getReferenceColumns() {
136 if (!isset(Civi::$statics[__CLASS__]['links'])) {
137 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
138 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
139 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
140 }
141 return Civi::$statics[__CLASS__]['links'];
142 }
143
144 /**
145 * Returns all the column names of this table
146 *
147 * @return array
148 */
149 public static function &fields() {
150 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
151 Civi::$statics[__CLASS__]['fields'] = [
152 'id' => [
153 'name' => 'id',
154 'type' => CRM_Utils_Type::T_INT,
155 'title' => ts('Pledge Block ID'),
156 'description' => ts('Pledge ID'),
157 'required' => TRUE,
158 'where' => 'civicrm_pledge_block.id',
159 'table_name' => 'civicrm_pledge_block',
160 'entity' => 'PledgeBlock',
161 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
162 'localizable' => 0,
163 'html' => [
164 'type' => 'Number',
165 ],
166 'readonly' => TRUE,
167 'add' => '2.1',
168 ],
169 'entity_table' => [
170 'name' => 'entity_table',
171 'type' => CRM_Utils_Type::T_STRING,
172 'title' => ts('Entity Table'),
173 'description' => ts('physical tablename for entity being joined to pledge, e.g. civicrm_contact'),
174 'maxlength' => 64,
175 'size' => CRM_Utils_Type::BIG,
176 'where' => 'civicrm_pledge_block.entity_table',
177 'table_name' => 'civicrm_pledge_block',
178 'entity' => 'PledgeBlock',
179 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
180 'localizable' => 0,
181 'add' => '2.1',
182 ],
183 'entity_id' => [
184 'name' => 'entity_id',
185 'type' => CRM_Utils_Type::T_INT,
186 'title' => ts('Entity ID'),
187 'description' => ts('FK to entity table specified in entity_table column.'),
188 'required' => TRUE,
189 'where' => 'civicrm_pledge_block.entity_id',
190 'table_name' => 'civicrm_pledge_block',
191 'entity' => 'PledgeBlock',
192 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
193 'localizable' => 0,
194 'add' => '2.1',
195 ],
196 'pledge_frequency_unit' => [
197 'name' => 'pledge_frequency_unit',
198 'type' => CRM_Utils_Type::T_STRING,
199 'title' => ts('Pledge Frequency Unit'),
200 'description' => ts('Delimited list of supported frequency units'),
201 'maxlength' => 128,
202 'size' => CRM_Utils_Type::HUGE,
203 'where' => 'civicrm_pledge_block.pledge_frequency_unit',
204 'table_name' => 'civicrm_pledge_block',
205 'entity' => 'PledgeBlock',
206 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
207 'localizable' => 0,
208 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED,
209 'add' => '2.1',
210 ],
211 'is_pledge_interval' => [
212 'name' => 'is_pledge_interval',
213 'type' => CRM_Utils_Type::T_BOOLEAN,
214 'title' => ts('Expose Frequency Interval?'),
215 'description' => ts('Is frequency interval exposed on the contribution form.'),
216 'where' => 'civicrm_pledge_block.is_pledge_interval',
217 'default' => '0',
218 'table_name' => 'civicrm_pledge_block',
219 'entity' => 'PledgeBlock',
220 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
221 'localizable' => 0,
222 'add' => '2.1',
223 ],
224 'max_reminders' => [
225 'name' => 'max_reminders',
226 'type' => CRM_Utils_Type::T_INT,
227 'title' => ts('Maximum Number of Reminders'),
228 'description' => ts('The maximum number of payment reminders to send for any given payment.'),
229 'where' => 'civicrm_pledge_block.max_reminders',
230 'default' => '1',
231 'table_name' => 'civicrm_pledge_block',
232 'entity' => 'PledgeBlock',
233 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
234 'localizable' => 0,
235 'add' => '2.1',
236 ],
237 'initial_reminder_day' => [
238 'name' => 'initial_reminder_day',
239 'type' => CRM_Utils_Type::T_INT,
240 'title' => ts('Initial Reminder Day'),
241 'description' => ts('Send initial reminder this many days prior to the payment due date.'),
242 'where' => 'civicrm_pledge_block.initial_reminder_day',
243 'default' => '5',
244 'table_name' => 'civicrm_pledge_block',
245 'entity' => 'PledgeBlock',
246 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
247 'localizable' => 0,
248 'add' => '2.1',
249 ],
250 'additional_reminder_day' => [
251 'name' => 'additional_reminder_day',
252 'type' => CRM_Utils_Type::T_INT,
253 'title' => ts('Additional Reminder Days'),
254 'description' => ts('Send additional reminder this many days after last one sent, up to maximum number of reminders.'),
255 'where' => 'civicrm_pledge_block.additional_reminder_day',
256 'default' => '5',
257 'table_name' => 'civicrm_pledge_block',
258 'entity' => 'PledgeBlock',
259 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
260 'localizable' => 0,
261 'add' => '2.1',
262 ],
263 'pledge_start_date' => [
264 'name' => 'pledge_start_date',
265 'type' => CRM_Utils_Type::T_STRING,
266 'title' => ts('Pledge Start Date'),
267 'description' => ts('The date the first scheduled pledge occurs.'),
268 'maxlength' => 64,
269 'size' => CRM_Utils_Type::BIG,
270 'where' => 'civicrm_pledge_block.pledge_start_date',
271 'table_name' => 'civicrm_pledge_block',
272 'entity' => 'PledgeBlock',
273 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
274 'localizable' => 0,
275 'add' => '4.7',
276 ],
277 'is_pledge_start_date_visible' => [
278 'name' => 'is_pledge_start_date_visible',
279 'type' => CRM_Utils_Type::T_BOOLEAN,
280 'title' => ts('Show Recurring Donation Start Date?'),
281 'description' => ts('If true - recurring start date is shown.'),
282 'required' => TRUE,
283 'where' => 'civicrm_pledge_block.is_pledge_start_date_visible',
284 'default' => '0',
285 'table_name' => 'civicrm_pledge_block',
286 'entity' => 'PledgeBlock',
287 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
288 'localizable' => 0,
289 'add' => '4.7',
290 ],
291 'is_pledge_start_date_editable' => [
292 'name' => 'is_pledge_start_date_editable',
293 'type' => CRM_Utils_Type::T_BOOLEAN,
294 'title' => ts('Allow Edits to Recurring Donation Start Date?'),
295 'description' => ts('If true - recurring start date is editable.'),
296 'required' => TRUE,
297 'where' => 'civicrm_pledge_block.is_pledge_start_date_editable',
298 'default' => '0',
299 'table_name' => 'civicrm_pledge_block',
300 'entity' => 'PledgeBlock',
301 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
302 'localizable' => 0,
303 'add' => '4.7',
304 ],
305 ];
306 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
307 }
308 return Civi::$statics[__CLASS__]['fields'];
309 }
310
311 /**
312 * Return a mapping from field-name to the corresponding key (as used in fields()).
313 *
314 * @return array
315 * Array(string $name => string $uniqueName).
316 */
317 public static function &fieldKeys() {
318 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
319 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
320 }
321 return Civi::$statics[__CLASS__]['fieldKeys'];
322 }
323
324 /**
325 * Returns the names of this table
326 *
327 * @return string
328 */
329 public static function getTableName() {
330 return self::$_tableName;
331 }
332
333 /**
334 * Returns if this table needs to be logged
335 *
336 * @return bool
337 */
338 public function getLog() {
339 return self::$_log;
340 }
341
342 /**
343 * Returns the list of fields that can be imported
344 *
345 * @param bool $prefix
346 *
347 * @return array
348 */
349 public static function &import($prefix = FALSE) {
350 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_block', $prefix, []);
351 return $r;
352 }
353
354 /**
355 * Returns the list of fields that can be exported
356 *
357 * @param bool $prefix
358 *
359 * @return array
360 */
361 public static function &export($prefix = FALSE) {
362 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_block', $prefix, []);
363 return $r;
364 }
365
366 /**
367 * Returns the list of indices
368 *
369 * @param bool $localize
370 *
371 * @return array
372 */
373 public static function indices($localize = TRUE) {
374 $indices = [
375 'index_entity' => [
376 'name' => 'index_entity',
377 'field' => [
378 0 => 'entity_table',
379 1 => 'entity_id',
380 ],
381 'localizable' => FALSE,
382 'sig' => 'civicrm_pledge_block::0::entity_table::entity_id',
383 ],
384 ];
385 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
386 }
387
388 }