Merge pull request #20093 from larssandergreen/mailings-AB-test-improvements
[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:a3bd49cda507ac9872922e16ff37a645)
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|null
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 'where' => 'civicrm_pledge_block.is_pledge_interval',
239 'default' => '0',
240 'table_name' => 'civicrm_pledge_block',
241 'entity' => 'PledgeBlock',
242 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
243 'localizable' => 0,
244 'add' => '2.1',
245 ],
246 'max_reminders' => [
247 'name' => 'max_reminders',
248 'type' => CRM_Utils_Type::T_INT,
249 'title' => ts('Maximum Number of Reminders'),
250 'description' => ts('The maximum number of payment reminders to send for any given payment.'),
251 'where' => 'civicrm_pledge_block.max_reminders',
252 'default' => '1',
253 'table_name' => 'civicrm_pledge_block',
254 'entity' => 'PledgeBlock',
255 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
256 'localizable' => 0,
257 'add' => '2.1',
258 ],
259 'initial_reminder_day' => [
260 'name' => 'initial_reminder_day',
261 'type' => CRM_Utils_Type::T_INT,
262 'title' => ts('Initial Reminder Day'),
263 'description' => ts('Send initial reminder this many days prior to the payment due date.'),
264 'where' => 'civicrm_pledge_block.initial_reminder_day',
265 'default' => '5',
266 'table_name' => 'civicrm_pledge_block',
267 'entity' => 'PledgeBlock',
268 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
269 'localizable' => 0,
270 'add' => '2.1',
271 ],
272 'additional_reminder_day' => [
273 'name' => 'additional_reminder_day',
274 'type' => CRM_Utils_Type::T_INT,
275 'title' => ts('Additional Reminder Days'),
276 'description' => ts('Send additional reminder this many days after last one sent, up to maximum number of reminders.'),
277 'where' => 'civicrm_pledge_block.additional_reminder_day',
278 'default' => '5',
279 'table_name' => 'civicrm_pledge_block',
280 'entity' => 'PledgeBlock',
281 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
282 'localizable' => 0,
283 'add' => '2.1',
284 ],
285 'pledge_start_date' => [
286 'name' => 'pledge_start_date',
287 'type' => CRM_Utils_Type::T_STRING,
288 'title' => ts('Pledge Start Date'),
289 'description' => ts('The date the first scheduled pledge occurs.'),
290 'maxlength' => 64,
291 'size' => CRM_Utils_Type::BIG,
292 'where' => 'civicrm_pledge_block.pledge_start_date',
293 'table_name' => 'civicrm_pledge_block',
294 'entity' => 'PledgeBlock',
295 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
296 'localizable' => 0,
297 'add' => '4.7',
298 ],
299 'is_pledge_start_date_visible' => [
300 'name' => 'is_pledge_start_date_visible',
301 'type' => CRM_Utils_Type::T_BOOLEAN,
302 'title' => ts('Show Recurring Donation Start Date?'),
303 'description' => ts('If true - recurring start date is shown.'),
304 'required' => TRUE,
305 'where' => 'civicrm_pledge_block.is_pledge_start_date_visible',
306 'default' => '0',
307 'table_name' => 'civicrm_pledge_block',
308 'entity' => 'PledgeBlock',
309 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
310 'localizable' => 0,
311 'add' => '4.7',
312 ],
313 'is_pledge_start_date_editable' => [
314 'name' => 'is_pledge_start_date_editable',
315 'type' => CRM_Utils_Type::T_BOOLEAN,
316 'title' => ts('Allow Edits to Recurring Donation Start Date?'),
317 'description' => ts('If true - recurring start date is editable.'),
318 'required' => TRUE,
319 'where' => 'civicrm_pledge_block.is_pledge_start_date_editable',
320 'default' => '0',
321 'table_name' => 'civicrm_pledge_block',
322 'entity' => 'PledgeBlock',
323 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
324 'localizable' => 0,
325 'add' => '4.7',
326 ],
327 ];
328 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
329 }
330 return Civi::$statics[__CLASS__]['fields'];
331 }
332
333 /**
334 * Return a mapping from field-name to the corresponding key (as used in fields()).
335 *
336 * @return array
337 * Array(string $name => string $uniqueName).
338 */
339 public static function &fieldKeys() {
340 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
341 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
342 }
343 return Civi::$statics[__CLASS__]['fieldKeys'];
344 }
345
346 /**
347 * Returns the names of this table
348 *
349 * @return string
350 */
351 public static function getTableName() {
352 return self::$_tableName;
353 }
354
355 /**
356 * Returns if this table needs to be logged
357 *
358 * @return bool
359 */
360 public function getLog() {
361 return self::$_log;
362 }
363
364 /**
365 * Returns the list of fields that can be imported
366 *
367 * @param bool $prefix
368 *
369 * @return array
370 */
371 public static function &import($prefix = FALSE) {
372 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_block', $prefix, []);
373 return $r;
374 }
375
376 /**
377 * Returns the list of fields that can be exported
378 *
379 * @param bool $prefix
380 *
381 * @return array
382 */
383 public static function &export($prefix = FALSE) {
384 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_block', $prefix, []);
385 return $r;
386 }
387
388 /**
389 * Returns the list of indices
390 *
391 * @param bool $localize
392 *
393 * @return array
394 */
395 public static function indices($localize = TRUE) {
396 $indices = [
397 'index_entity' => [
398 'name' => 'index_entity',
399 'field' => [
400 0 => 'entity_table',
401 1 => 'entity_id',
402 ],
403 'localizable' => FALSE,
404 'sig' => 'civicrm_pledge_block::0::entity_table::entity_id',
405 ],
406 ];
407 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
408 }
409
410 }