Merge pull request #13278 from aydun/abstract_token_class_prop
[civicrm-core.git] / CRM / Pledge / DAO / PledgeBlock.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Pledge/PledgeBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:cdc529b617a76a84e18455737f4e7a03)
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 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 static $_log = TRUE;
30
31 /**
32 * Pledge ID
33 *
34 * @var int unsigned
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 unsigned
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 boolean
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 unsigned
70 */
71 public $max_reminders;
72
73 /**
74 * Send initial reminder this many days prior to the payment due date.
75 *
76 * @var int unsigned
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 unsigned
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 boolean
98 */
99 public $is_pledge_start_date_visible;
100
101 /**
102 * If true - recurring start date is editable.
103 *
104 * @var boolean
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 foreign keys and entity references.
118 *
119 * @return array
120 * [CRM_Core_Reference_Interface]
121 */
122 public static function getReferenceColumns() {
123 if (!isset(Civi::$statics[__CLASS__]['links'])) {
124 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
125 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
126 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
127 }
128 return Civi::$statics[__CLASS__]['links'];
129 }
130
131 /**
132 * Returns all the column names of this table
133 *
134 * @return array
135 */
136 public static function &fields() {
137 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
138 Civi::$statics[__CLASS__]['fields'] = [
139 'id' => [
140 'name' => 'id',
141 'type' => CRM_Utils_Type::T_INT,
142 'title' => ts('Pledge Block ID'),
143 'description' => ts('Pledge ID'),
144 'required' => TRUE,
145 'table_name' => 'civicrm_pledge_block',
146 'entity' => 'PledgeBlock',
147 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
148 'localizable' => 0,
149 ],
150 'entity_table' => [
151 'name' => 'entity_table',
152 'type' => CRM_Utils_Type::T_STRING,
153 'title' => ts('Entity Table'),
154 'description' => ts('physical tablename for entity being joined to pledge, e.g. civicrm_contact'),
155 'maxlength' => 64,
156 'size' => CRM_Utils_Type::BIG,
157 'table_name' => 'civicrm_pledge_block',
158 'entity' => 'PledgeBlock',
159 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
160 'localizable' => 0,
161 ],
162 'entity_id' => [
163 'name' => 'entity_id',
164 'type' => CRM_Utils_Type::T_INT,
165 'title' => ts('Entity Id'),
166 'description' => ts('FK to entity table specified in entity_table column.'),
167 'required' => TRUE,
168 'table_name' => 'civicrm_pledge_block',
169 'entity' => 'PledgeBlock',
170 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
171 'localizable' => 0,
172 ],
173 'pledge_frequency_unit' => [
174 'name' => 'pledge_frequency_unit',
175 'type' => CRM_Utils_Type::T_STRING,
176 'title' => ts('Pledge Frequency Unit'),
177 'description' => ts('Delimited list of supported frequency units'),
178 'maxlength' => 128,
179 'size' => CRM_Utils_Type::HUGE,
180 'table_name' => 'civicrm_pledge_block',
181 'entity' => 'PledgeBlock',
182 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
183 'localizable' => 0,
184 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED,
185 ],
186 'is_pledge_interval' => [
187 'name' => 'is_pledge_interval',
188 'type' => CRM_Utils_Type::T_BOOLEAN,
189 'title' => ts('Expose Frequency Interval?'),
190 'description' => ts('Is frequency interval exposed on the contribution form.'),
191 'default' => '0',
192 'table_name' => 'civicrm_pledge_block',
193 'entity' => 'PledgeBlock',
194 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
195 'localizable' => 0,
196 ],
197 'max_reminders' => [
198 'name' => 'max_reminders',
199 'type' => CRM_Utils_Type::T_INT,
200 'title' => ts('Maximum Number of Reminders'),
201 'description' => ts('The maximum number of payment reminders to send for any given payment.'),
202 'default' => '1',
203 'table_name' => 'civicrm_pledge_block',
204 'entity' => 'PledgeBlock',
205 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
206 'localizable' => 0,
207 ],
208 'initial_reminder_day' => [
209 'name' => 'initial_reminder_day',
210 'type' => CRM_Utils_Type::T_INT,
211 'title' => ts('Initial Reminder Day'),
212 'description' => ts('Send initial reminder this many days prior to the payment due date.'),
213 'default' => '5',
214 'table_name' => 'civicrm_pledge_block',
215 'entity' => 'PledgeBlock',
216 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
217 'localizable' => 0,
218 ],
219 'additional_reminder_day' => [
220 'name' => 'additional_reminder_day',
221 'type' => CRM_Utils_Type::T_INT,
222 'title' => ts('Additional Reminder Days'),
223 'description' => ts('Send additional reminder this many days after last one sent, up to maximum number of reminders.'),
224 'default' => '5',
225 'table_name' => 'civicrm_pledge_block',
226 'entity' => 'PledgeBlock',
227 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
228 'localizable' => 0,
229 ],
230 'pledge_start_date' => [
231 'name' => 'pledge_start_date',
232 'type' => CRM_Utils_Type::T_STRING,
233 'title' => ts('Pledge Start Date'),
234 'description' => ts('The date the first scheduled pledge occurs.'),
235 'maxlength' => 64,
236 'size' => CRM_Utils_Type::BIG,
237 'table_name' => 'civicrm_pledge_block',
238 'entity' => 'PledgeBlock',
239 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
240 'localizable' => 0,
241 ],
242 'is_pledge_start_date_visible' => [
243 'name' => 'is_pledge_start_date_visible',
244 'type' => CRM_Utils_Type::T_BOOLEAN,
245 'title' => ts('Show Recurring Donation Start Date?'),
246 'description' => ts('If true - recurring start date is shown.'),
247 'required' => TRUE,
248 'default' => '0',
249 'table_name' => 'civicrm_pledge_block',
250 'entity' => 'PledgeBlock',
251 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
252 'localizable' => 0,
253 ],
254 'is_pledge_start_date_editable' => [
255 'name' => 'is_pledge_start_date_editable',
256 'type' => CRM_Utils_Type::T_BOOLEAN,
257 'title' => ts('Allow Edits to Recurring Donation Start Date?'),
258 'description' => ts('If true - recurring start date is editable.'),
259 'required' => TRUE,
260 'default' => '0',
261 'table_name' => 'civicrm_pledge_block',
262 'entity' => 'PledgeBlock',
263 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
264 'localizable' => 0,
265 ],
266 ];
267 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
268 }
269 return Civi::$statics[__CLASS__]['fields'];
270 }
271
272 /**
273 * Return a mapping from field-name to the corresponding key (as used in fields()).
274 *
275 * @return array
276 * Array(string $name => string $uniqueName).
277 */
278 public static function &fieldKeys() {
279 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
280 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
281 }
282 return Civi::$statics[__CLASS__]['fieldKeys'];
283 }
284
285 /**
286 * Returns the names of this table
287 *
288 * @return string
289 */
290 public static function getTableName() {
291 return self::$_tableName;
292 }
293
294 /**
295 * Returns if this table needs to be logged
296 *
297 * @return bool
298 */
299 public function getLog() {
300 return self::$_log;
301 }
302
303 /**
304 * Returns the list of fields that can be imported
305 *
306 * @param bool $prefix
307 *
308 * @return array
309 */
310 public static function &import($prefix = FALSE) {
311 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_block', $prefix, []);
312 return $r;
313 }
314
315 /**
316 * Returns the list of fields that can be exported
317 *
318 * @param bool $prefix
319 *
320 * @return array
321 */
322 public static function &export($prefix = FALSE) {
323 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_block', $prefix, []);
324 return $r;
325 }
326
327 /**
328 * Returns the list of indices
329 *
330 * @param bool $localize
331 *
332 * @return array
333 */
334 public static function indices($localize = TRUE) {
335 $indices = [
336 'index_entity' => [
337 'name' => 'index_entity',
338 'field' => [
339 0 => 'entity_table',
340 1 => 'entity_id',
341 ],
342 'localizable' => FALSE,
343 'sig' => 'civicrm_pledge_block::0::entity_table::entity_id',
344 ],
345 ];
346 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
347 }
348
349 }