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:a3bd49cda507ac9872922e16ff37a645)
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.
73 * @var bool|string|null
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.'),
238 'where' => 'civicrm_pledge_block.is_pledge_interval',
240 'table_name' => 'civicrm_pledge_block',
241 'entity' => 'PledgeBlock',
242 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
247 'name' => 'max_reminders',
248 'type' => CRM_Utils_Type
::T_INT
,
249 'title' => ts('Maximum Number of Reminders'),
250 'description' => ts('The maximum number of payment reminders to send for any given payment.'),
251 'where' => 'civicrm_pledge_block.max_reminders',
253 'table_name' => 'civicrm_pledge_block',
254 'entity' => 'PledgeBlock',
255 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
259 'initial_reminder_day' => [
260 'name' => 'initial_reminder_day',
261 'type' => CRM_Utils_Type
::T_INT
,
262 'title' => ts('Initial Reminder Day'),
263 'description' => ts('Send initial reminder this many days prior to the payment due date.'),
264 'where' => 'civicrm_pledge_block.initial_reminder_day',
266 'table_name' => 'civicrm_pledge_block',
267 'entity' => 'PledgeBlock',
268 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
272 'additional_reminder_day' => [
273 'name' => 'additional_reminder_day',
274 'type' => CRM_Utils_Type
::T_INT
,
275 'title' => ts('Additional Reminder Days'),
276 'description' => ts('Send additional reminder this many days after last one sent, up to maximum number of reminders.'),
277 'where' => 'civicrm_pledge_block.additional_reminder_day',
279 'table_name' => 'civicrm_pledge_block',
280 'entity' => 'PledgeBlock',
281 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
285 'pledge_start_date' => [
286 'name' => 'pledge_start_date',
287 'type' => CRM_Utils_Type
::T_STRING
,
288 'title' => ts('Pledge Start Date'),
289 'description' => ts('The date the first scheduled pledge occurs.'),
291 'size' => CRM_Utils_Type
::BIG
,
292 'where' => 'civicrm_pledge_block.pledge_start_date',
293 'table_name' => 'civicrm_pledge_block',
294 'entity' => 'PledgeBlock',
295 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
299 'is_pledge_start_date_visible' => [
300 'name' => 'is_pledge_start_date_visible',
301 'type' => CRM_Utils_Type
::T_BOOLEAN
,
302 'title' => ts('Show Recurring Donation Start Date?'),
303 'description' => ts('If true - recurring start date is shown.'),
305 'where' => 'civicrm_pledge_block.is_pledge_start_date_visible',
307 'table_name' => 'civicrm_pledge_block',
308 'entity' => 'PledgeBlock',
309 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
313 'is_pledge_start_date_editable' => [
314 'name' => 'is_pledge_start_date_editable',
315 'type' => CRM_Utils_Type
::T_BOOLEAN
,
316 'title' => ts('Allow Edits to Recurring Donation Start Date?'),
317 'description' => ts('If true - recurring start date is editable.'),
319 'where' => 'civicrm_pledge_block.is_pledge_start_date_editable',
321 'table_name' => 'civicrm_pledge_block',
322 'entity' => 'PledgeBlock',
323 'bao' => 'CRM_Pledge_BAO_PledgeBlock',
328 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
330 return Civi
::$statics[__CLASS__
]['fields'];
334 * Return a mapping from field-name to the corresponding key (as used in fields()).
337 * Array(string $name => string $uniqueName).
339 public static function &fieldKeys() {
340 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
341 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
343 return Civi
::$statics[__CLASS__
]['fieldKeys'];
347 * Returns the names of this table
351 public static function getTableName() {
352 return self
::$_tableName;
356 * Returns if this table needs to be logged
360 public function getLog() {
365 * Returns the list of fields that can be imported
367 * @param bool $prefix
371 public static function &import($prefix = FALSE) {
372 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pledge_block', $prefix, []);
377 * Returns the list of fields that can be exported
379 * @param bool $prefix
383 public static function &export($prefix = FALSE) {
384 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pledge_block', $prefix, []);
389 * Returns the list of indices
391 * @param bool $localize
395 public static function indices($localize = TRUE) {
398 'name' => 'index_entity',
403 'localizable' => FALSE,
404 'sig' => 'civicrm_pledge_block::0::entity_table::entity_id',
407 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;