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