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