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