Reformat DAO files to pass linting and use short array syntax
[civicrm-core.git] / CRM / Pledge / DAO / PledgeBlock.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2017
6 *
7 * Generated from xml/schema/CRM/Pledge/PledgeBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:630f1a7378136b8cc3edcd82a96279d6)
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' => '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' => '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' => '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' => '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' => 'Is frequency interval exposed on the contribution form.',
191 'table_name' => 'civicrm_pledge_block',
192 'entity' => 'PledgeBlock',
193 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
194 'localizable' => 0,
195 ],
196 'max_reminders' => [
197 'name' => 'max_reminders',
198 'type' => CRM_Utils_Type::T_INT,
199 'title' => ts('Maximum Number of Reminders'),
200 'description' => 'The maximum number of payment reminders to send for any given payment.',
201 'default' => '1',
202 'table_name' => 'civicrm_pledge_block',
203 'entity' => 'PledgeBlock',
204 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
205 'localizable' => 0,
206 ],
207 'initial_reminder_day' => [
208 'name' => 'initial_reminder_day',
209 'type' => CRM_Utils_Type::T_INT,
210 'title' => ts('Initial Reminder Day'),
211 'description' => 'Send initial reminder this many days prior to the payment due date.',
212 'default' => '5',
213 'table_name' => 'civicrm_pledge_block',
214 'entity' => 'PledgeBlock',
215 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
216 'localizable' => 0,
217 ],
218 'additional_reminder_day' => [
219 'name' => 'additional_reminder_day',
220 'type' => CRM_Utils_Type::T_INT,
221 'title' => ts('Additional Reminder Days'),
222 'description' => 'Send additional reminder this many days after last one sent, up to maximum number of reminders.',
223 'default' => '5',
224 'table_name' => 'civicrm_pledge_block',
225 'entity' => 'PledgeBlock',
226 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
227 'localizable' => 0,
228 ],
229 'pledge_start_date' => [
230 'name' => 'pledge_start_date',
231 'type' => CRM_Utils_Type::T_STRING,
232 'title' => ts('Pledge Start Date'),
233 'description' => 'The date the first scheduled pledge occurs.',
234 'maxlength' => 64,
235 'size' => CRM_Utils_Type::BIG,
236 'table_name' => 'civicrm_pledge_block',
237 'entity' => 'PledgeBlock',
238 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
239 'localizable' => 0,
240 ],
241 'is_pledge_start_date_visible' => [
242 'name' => 'is_pledge_start_date_visible',
243 'type' => CRM_Utils_Type::T_BOOLEAN,
244 'title' => ts('Show Recurring Donation Start Date?'),
245 'description' => 'If true - recurring start date is shown.',
246 'required' => TRUE,
247 'table_name' => 'civicrm_pledge_block',
248 'entity' => 'PledgeBlock',
249 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
250 'localizable' => 0,
251 ],
252 'is_pledge_start_date_editable' => [
253 'name' => 'is_pledge_start_date_editable',
254 'type' => CRM_Utils_Type::T_BOOLEAN,
255 'title' => ts('Allow Edits to Recurring Donation Start Date?'),
256 'description' => 'If true - recurring start date is editable.',
257 'required' => TRUE,
258 'table_name' => 'civicrm_pledge_block',
259 'entity' => 'PledgeBlock',
260 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
261 'localizable' => 0,
262 ],
263 ];
264 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
265 }
266 return Civi::$statics[__CLASS__]['fields'];
267 }
268
269 /**
270 * Return a mapping from field-name to the corresponding key (as used in fields()).
271 *
272 * @return array
273 * Array(string $name => string $uniqueName).
274 */
275 public static function &fieldKeys() {
276 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
277 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
278 }
279 return Civi::$statics[__CLASS__]['fieldKeys'];
280 }
281
282 /**
283 * Returns the names of this table
284 *
285 * @return string
286 */
287 public static function getTableName() {
288 return self::$_tableName;
289 }
290
291 /**
292 * Returns if this table needs to be logged
293 *
294 * @return bool
295 */
296 public function getLog() {
297 return self::$_log;
298 }
299
300 /**
301 * Returns the list of fields that can be imported
302 *
303 * @param bool $prefix
304 *
305 * @return array
306 */
307 public static function &import($prefix = FALSE) {
308 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_block', $prefix, []);
309 return $r;
310 }
311
312 /**
313 * Returns the list of fields that can be exported
314 *
315 * @param bool $prefix
316 *
317 * @return array
318 */
319 public static function &export($prefix = FALSE) {
320 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_block', $prefix, []);
321 return $r;
322 }
323
324 /**
325 * Returns the list of indices
326 *
327 * @param bool $localize
328 *
329 * @return array
330 */
331 public static function indices($localize = TRUE) {
332 $indices = [
333 'index_entity' => [
334 'name' => 'index_entity',
335 'field' => [
336 0 => 'entity_table',
337 1 => 'entity_id',
338 ],
339 'localizable' => FALSE,
340 'sig' => 'civicrm_pledge_block::0::entity_table::entity_id',
341 ],
342 ];
343 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
344 }
345
346 }