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