5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Pledge/PledgeBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:5c573642b549c72e343477a782ed62dc)
13 * Database access object for the PledgeBlock entity.
15 class CRM_Pledge_DAO_PledgeBlock
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.1';
18 const COMPONENT
= 'CiviPledge';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_pledge_block';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
37 * @var int|string|null
38 * (SQL type: int unsigned)
39 * Note that values will be retrieved from the database as a string.
44 * physical tablename for entity being joined to pledge, e.g. civicrm_contact
47 * (SQL type: varchar(64))
48 * Note that values will be retrieved from the database as a string.
53 * FK to entity table specified in entity_table column.
56 * (SQL type: int unsigned)
57 * Note that values will be retrieved from the database as a string.
62 * Delimited list of supported frequency units
65 * (SQL type: varchar(128))
66 * Note that values will be retrieved from the database as a string.
68 public $pledge_frequency_unit;
71 * Is frequency interval exposed on the contribution form.
75 * Note that values will be retrieved from the database as a string.
77 public $is_pledge_interval;
80 * The maximum number of payment reminders to send for any given payment.
82 * @var int|string|null
83 * (SQL type: int unsigned)
84 * Note that values will be retrieved from the database as a string.
86 public $max_reminders;
89 * Send initial reminder this many days prior to the payment due date.
91 * @var int|string|null
92 * (SQL type: int unsigned)
93 * Note that values will be retrieved from the database as a string.
95 public $initial_reminder_day;
98 * Send additional reminder this many days after last one sent, up to maximum number of reminders.
100 * @var int|string|null
101 * (SQL type: int unsigned)
102 * Note that values will be retrieved from the database as a string.
104 public $additional_reminder_day;
107 * The date the first scheduled pledge occurs.
110 * (SQL type: varchar(64))
111 * Note that values will be retrieved from the database as a string.
113 public $pledge_start_date;
116 * If true - recurring start date is shown.
119 * (SQL type: tinyint)
120 * Note that values will be retrieved from the database as a string.
122 public $is_pledge_start_date_visible;
125 * If true - recurring start date is editable.
128 * (SQL type: tinyint)
129 * Note that values will be retrieved from the database as a string.
131 public $is_pledge_start_date_editable;
136 public function __construct() {
137 $this->__table
= 'civicrm_pledge_block';
138 parent
::__construct();
142 * Returns localized title of this entity.
144 * @param bool $plural
145 * Whether to return the plural version of the title.
147 public static function getEntityTitle($plural = FALSE) {
148 return $plural ?
ts('Pledge Blocks') : ts('Pledge Block');
152 * Returns foreign keys and entity references.
155 * [CRM_Core_Reference_Interface]
157 public static function getReferenceColumns() {
158 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
159 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
160 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
161 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
163 return Civi
::$statics[__CLASS__
]['links'];
167 * Returns all the column names of this table
171 public static function &fields() {
172 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
173 Civi
::$statics[__CLASS__
]['fields'] = [
176 'type' => CRM_Utils_Type
::T_INT
,
177 'title' => ts('Pledge Block ID'),
178 'description' => ts('Pledge ID'),
180 'where' => 'civicrm_pledge_block.id',
181 'table_name' => 'civicrm_pledge_block',
182 'entity' => 'PledgeBlock',
183 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
192 'name' => 'entity_table',
193 'type' => CRM_Utils_Type
::T_STRING
,
194 'title' => ts('Entity Table'),
195 'description' => ts('physical tablename for entity being joined to pledge, e.g. civicrm_contact'),
197 'size' => CRM_Utils_Type
::BIG
,
198 'where' => 'civicrm_pledge_block.entity_table',
199 'table_name' => 'civicrm_pledge_block',
200 'entity' => 'PledgeBlock',
201 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
206 'name' => 'entity_id',
207 'type' => CRM_Utils_Type
::T_INT
,
208 'title' => ts('Entity ID'),
209 'description' => ts('FK to entity table specified in entity_table column.'),
211 'where' => 'civicrm_pledge_block.entity_id',
212 'table_name' => 'civicrm_pledge_block',
213 'entity' => 'PledgeBlock',
214 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
218 'pledge_frequency_unit' => [
219 'name' => 'pledge_frequency_unit',
220 'type' => CRM_Utils_Type
::T_STRING
,
221 'title' => ts('Pledge Frequency Unit'),
222 'description' => ts('Delimited list of supported frequency units'),
224 'size' => CRM_Utils_Type
::HUGE
,
225 'where' => 'civicrm_pledge_block.pledge_frequency_unit',
226 'table_name' => 'civicrm_pledge_block',
227 'entity' => 'PledgeBlock',
228 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
230 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
233 'is_pledge_interval' => [
234 'name' => 'is_pledge_interval',
235 'type' => CRM_Utils_Type
::T_BOOLEAN
,
236 'title' => ts('Expose Frequency Interval?'),
237 'description' => ts('Is frequency interval exposed on the contribution form.'),
239 'where' => 'civicrm_pledge_block.is_pledge_interval',
241 'table_name' => 'civicrm_pledge_block',
242 'entity' => 'PledgeBlock',
243 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
248 'name' => 'max_reminders',
249 'type' => CRM_Utils_Type
::T_INT
,
250 'title' => ts('Maximum Number of Reminders'),
251 'description' => ts('The maximum number of payment reminders to send for any given payment.'),
252 'where' => 'civicrm_pledge_block.max_reminders',
254 'table_name' => 'civicrm_pledge_block',
255 'entity' => 'PledgeBlock',
256 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
260 'initial_reminder_day' => [
261 'name' => 'initial_reminder_day',
262 'type' => CRM_Utils_Type
::T_INT
,
263 'title' => ts('Initial Reminder Day'),
264 'description' => ts('Send initial reminder this many days prior to the payment due date.'),
265 'where' => 'civicrm_pledge_block.initial_reminder_day',
267 'table_name' => 'civicrm_pledge_block',
268 'entity' => 'PledgeBlock',
269 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
273 'additional_reminder_day' => [
274 'name' => 'additional_reminder_day',
275 'type' => CRM_Utils_Type
::T_INT
,
276 'title' => ts('Additional Reminder Days'),
277 'description' => ts('Send additional reminder this many days after last one sent, up to maximum number of reminders.'),
278 'where' => 'civicrm_pledge_block.additional_reminder_day',
280 'table_name' => 'civicrm_pledge_block',
281 'entity' => 'PledgeBlock',
282 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
286 'pledge_start_date' => [
287 'name' => 'pledge_start_date',
288 'type' => CRM_Utils_Type
::T_STRING
,
289 'title' => ts('Pledge Start Date'),
290 'description' => ts('The date the first scheduled pledge occurs.'),
292 'size' => CRM_Utils_Type
::BIG
,
293 'where' => 'civicrm_pledge_block.pledge_start_date',
294 'table_name' => 'civicrm_pledge_block',
295 'entity' => 'PledgeBlock',
296 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
300 'is_pledge_start_date_visible' => [
301 'name' => 'is_pledge_start_date_visible',
302 'type' => CRM_Utils_Type
::T_BOOLEAN
,
303 'title' => ts('Show Recurring Donation Start Date?'),
304 'description' => ts('If true - recurring start date is shown.'),
306 'where' => 'civicrm_pledge_block.is_pledge_start_date_visible',
308 'table_name' => 'civicrm_pledge_block',
309 'entity' => 'PledgeBlock',
310 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
314 'is_pledge_start_date_editable' => [
315 'name' => 'is_pledge_start_date_editable',
316 'type' => CRM_Utils_Type
::T_BOOLEAN
,
317 'title' => ts('Allow Edits to Recurring Donation Start Date?'),
318 'description' => ts('If true - recurring start date is editable.'),
320 'where' => 'civicrm_pledge_block.is_pledge_start_date_editable',
322 'table_name' => 'civicrm_pledge_block',
323 'entity' => 'PledgeBlock',
324 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
329 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
331 return Civi
::$statics[__CLASS__
]['fields'];
335 * Return a mapping from field-name to the corresponding key (as used in fields()).
338 * Array(string $name => string $uniqueName).
340 public static function &fieldKeys() {
341 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
342 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
344 return Civi
::$statics[__CLASS__
]['fieldKeys'];
348 * Returns the names of this table
352 public static function getTableName() {
353 return self
::$_tableName;
357 * Returns if this table needs to be logged
361 public function getLog() {
366 * Returns the list of fields that can be imported
368 * @param bool $prefix
372 public static function &import($prefix = FALSE) {
373 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pledge_block', $prefix, []);
378 * Returns the list of fields that can be exported
380 * @param bool $prefix
384 public static function &export($prefix = FALSE) {
385 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pledge_block', $prefix, []);
390 * Returns the list of indices
392 * @param bool $localize
396 public static function indices($localize = TRUE) {
399 'name' => 'index_entity',
404 'localizable' => FALSE,
405 'sig' => 'civicrm_pledge_block::0::entity_table::entity_id',
408 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;