| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Pledge/PledgeBlock.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:dd1489be32b1ac4cf012b93cb68afb10) |
| 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 | public 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 | public static $_log = TRUE; |
| 30 | |
| 31 | /** |
| 32 | * Pledge ID |
| 33 | * |
| 34 | * @var int |
| 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 |
| 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 bool |
| 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 |
| 70 | */ |
| 71 | public $max_reminders; |
| 72 | |
| 73 | /** |
| 74 | * Send initial reminder this many days prior to the payment due date. |
| 75 | * |
| 76 | * @var int |
| 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 |
| 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 bool |
| 98 | */ |
| 99 | public $is_pledge_start_date_visible; |
| 100 | |
| 101 | /** |
| 102 | * If true - recurring start date is editable. |
| 103 | * |
| 104 | * @var bool |
| 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' => ts('Pledge ID'), |
| 144 | 'required' => TRUE, |
| 145 | 'where' => 'civicrm_pledge_block.id', |
| 146 | 'table_name' => 'civicrm_pledge_block', |
| 147 | 'entity' => 'PledgeBlock', |
| 148 | 'bao' => 'CRM_Pledge_BAO_PledgeBlock', |
| 149 | 'localizable' => 0, |
| 150 | ], |
| 151 | 'entity_table' => [ |
| 152 | 'name' => 'entity_table', |
| 153 | 'type' => CRM_Utils_Type::T_STRING, |
| 154 | 'title' => ts('Entity Table'), |
| 155 | 'description' => ts('physical tablename for entity being joined to pledge, e.g. civicrm_contact'), |
| 156 | 'maxlength' => 64, |
| 157 | 'size' => CRM_Utils_Type::BIG, |
| 158 | 'where' => 'civicrm_pledge_block.entity_table', |
| 159 | 'table_name' => 'civicrm_pledge_block', |
| 160 | 'entity' => 'PledgeBlock', |
| 161 | 'bao' => 'CRM_Pledge_BAO_PledgeBlock', |
| 162 | 'localizable' => 0, |
| 163 | ], |
| 164 | 'entity_id' => [ |
| 165 | 'name' => 'entity_id', |
| 166 | 'type' => CRM_Utils_Type::T_INT, |
| 167 | 'title' => ts('Entity Id'), |
| 168 | 'description' => ts('FK to entity table specified in entity_table column.'), |
| 169 | 'required' => TRUE, |
| 170 | 'where' => 'civicrm_pledge_block.entity_id', |
| 171 | 'table_name' => 'civicrm_pledge_block', |
| 172 | 'entity' => 'PledgeBlock', |
| 173 | 'bao' => 'CRM_Pledge_BAO_PledgeBlock', |
| 174 | 'localizable' => 0, |
| 175 | ], |
| 176 | 'pledge_frequency_unit' => [ |
| 177 | 'name' => 'pledge_frequency_unit', |
| 178 | 'type' => CRM_Utils_Type::T_STRING, |
| 179 | 'title' => ts('Pledge Frequency Unit'), |
| 180 | 'description' => ts('Delimited list of supported frequency units'), |
| 181 | 'maxlength' => 128, |
| 182 | 'size' => CRM_Utils_Type::HUGE, |
| 183 | 'where' => 'civicrm_pledge_block.pledge_frequency_unit', |
| 184 | 'table_name' => 'civicrm_pledge_block', |
| 185 | 'entity' => 'PledgeBlock', |
| 186 | 'bao' => 'CRM_Pledge_BAO_PledgeBlock', |
| 187 | 'localizable' => 0, |
| 188 | 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED, |
| 189 | ], |
| 190 | 'is_pledge_interval' => [ |
| 191 | 'name' => 'is_pledge_interval', |
| 192 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 193 | 'title' => ts('Expose Frequency Interval?'), |
| 194 | 'description' => ts('Is frequency interval exposed on the contribution form.'), |
| 195 | 'where' => 'civicrm_pledge_block.is_pledge_interval', |
| 196 | 'default' => '0', |
| 197 | 'table_name' => 'civicrm_pledge_block', |
| 198 | 'entity' => 'PledgeBlock', |
| 199 | 'bao' => 'CRM_Pledge_BAO_PledgeBlock', |
| 200 | 'localizable' => 0, |
| 201 | ], |
| 202 | 'max_reminders' => [ |
| 203 | 'name' => 'max_reminders', |
| 204 | 'type' => CRM_Utils_Type::T_INT, |
| 205 | 'title' => ts('Maximum Number of Reminders'), |
| 206 | 'description' => ts('The maximum number of payment reminders to send for any given payment.'), |
| 207 | 'where' => 'civicrm_pledge_block.max_reminders', |
| 208 | 'default' => '1', |
| 209 | 'table_name' => 'civicrm_pledge_block', |
| 210 | 'entity' => 'PledgeBlock', |
| 211 | 'bao' => 'CRM_Pledge_BAO_PledgeBlock', |
| 212 | 'localizable' => 0, |
| 213 | ], |
| 214 | 'initial_reminder_day' => [ |
| 215 | 'name' => 'initial_reminder_day', |
| 216 | 'type' => CRM_Utils_Type::T_INT, |
| 217 | 'title' => ts('Initial Reminder Day'), |
| 218 | 'description' => ts('Send initial reminder this many days prior to the payment due date.'), |
| 219 | 'where' => 'civicrm_pledge_block.initial_reminder_day', |
| 220 | 'default' => '5', |
| 221 | 'table_name' => 'civicrm_pledge_block', |
| 222 | 'entity' => 'PledgeBlock', |
| 223 | 'bao' => 'CRM_Pledge_BAO_PledgeBlock', |
| 224 | 'localizable' => 0, |
| 225 | ], |
| 226 | 'additional_reminder_day' => [ |
| 227 | 'name' => 'additional_reminder_day', |
| 228 | 'type' => CRM_Utils_Type::T_INT, |
| 229 | 'title' => ts('Additional Reminder Days'), |
| 230 | 'description' => ts('Send additional reminder this many days after last one sent, up to maximum number of reminders.'), |
| 231 | 'where' => 'civicrm_pledge_block.additional_reminder_day', |
| 232 | 'default' => '5', |
| 233 | 'table_name' => 'civicrm_pledge_block', |
| 234 | 'entity' => 'PledgeBlock', |
| 235 | 'bao' => 'CRM_Pledge_BAO_PledgeBlock', |
| 236 | 'localizable' => 0, |
| 237 | ], |
| 238 | 'pledge_start_date' => [ |
| 239 | 'name' => 'pledge_start_date', |
| 240 | 'type' => CRM_Utils_Type::T_STRING, |
| 241 | 'title' => ts('Pledge Start Date'), |
| 242 | 'description' => ts('The date the first scheduled pledge occurs.'), |
| 243 | 'maxlength' => 64, |
| 244 | 'size' => CRM_Utils_Type::BIG, |
| 245 | 'where' => 'civicrm_pledge_block.pledge_start_date', |
| 246 | 'table_name' => 'civicrm_pledge_block', |
| 247 | 'entity' => 'PledgeBlock', |
| 248 | 'bao' => 'CRM_Pledge_BAO_PledgeBlock', |
| 249 | 'localizable' => 0, |
| 250 | ], |
| 251 | 'is_pledge_start_date_visible' => [ |
| 252 | 'name' => 'is_pledge_start_date_visible', |
| 253 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 254 | 'title' => ts('Show Recurring Donation Start Date?'), |
| 255 | 'description' => ts('If true - recurring start date is shown.'), |
| 256 | 'required' => TRUE, |
| 257 | 'where' => 'civicrm_pledge_block.is_pledge_start_date_visible', |
| 258 | 'default' => '0', |
| 259 | 'table_name' => 'civicrm_pledge_block', |
| 260 | 'entity' => 'PledgeBlock', |
| 261 | 'bao' => 'CRM_Pledge_BAO_PledgeBlock', |
| 262 | 'localizable' => 0, |
| 263 | ], |
| 264 | 'is_pledge_start_date_editable' => [ |
| 265 | 'name' => 'is_pledge_start_date_editable', |
| 266 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 267 | 'title' => ts('Allow Edits to Recurring Donation Start Date?'), |
| 268 | 'description' => ts('If true - recurring start date is editable.'), |
| 269 | 'required' => TRUE, |
| 270 | 'where' => 'civicrm_pledge_block.is_pledge_start_date_editable', |
| 271 | 'default' => '0', |
| 272 | 'table_name' => 'civicrm_pledge_block', |
| 273 | 'entity' => 'PledgeBlock', |
| 274 | 'bao' => 'CRM_Pledge_BAO_PledgeBlock', |
| 275 | 'localizable' => 0, |
| 276 | ], |
| 277 | ]; |
| 278 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 279 | } |
| 280 | return Civi::$statics[__CLASS__]['fields']; |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 285 | * |
| 286 | * @return array |
| 287 | * Array(string $name => string $uniqueName). |
| 288 | */ |
| 289 | public static function &fieldKeys() { |
| 290 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
| 291 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); |
| 292 | } |
| 293 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * Returns the names of this table |
| 298 | * |
| 299 | * @return string |
| 300 | */ |
| 301 | public static function getTableName() { |
| 302 | return self::$_tableName; |
| 303 | } |
| 304 | |
| 305 | /** |
| 306 | * Returns if this table needs to be logged |
| 307 | * |
| 308 | * @return bool |
| 309 | */ |
| 310 | public function getLog() { |
| 311 | return self::$_log; |
| 312 | } |
| 313 | |
| 314 | /** |
| 315 | * Returns the list of fields that can be imported |
| 316 | * |
| 317 | * @param bool $prefix |
| 318 | * |
| 319 | * @return array |
| 320 | */ |
| 321 | public static function &import($prefix = FALSE) { |
| 322 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_block', $prefix, []); |
| 323 | return $r; |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * Returns the list of fields that can be exported |
| 328 | * |
| 329 | * @param bool $prefix |
| 330 | * |
| 331 | * @return array |
| 332 | */ |
| 333 | public static function &export($prefix = FALSE) { |
| 334 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_block', $prefix, []); |
| 335 | return $r; |
| 336 | } |
| 337 | |
| 338 | /** |
| 339 | * Returns the list of indices |
| 340 | * |
| 341 | * @param bool $localize |
| 342 | * |
| 343 | * @return array |
| 344 | */ |
| 345 | public static function indices($localize = TRUE) { |
| 346 | $indices = [ |
| 347 | 'index_entity' => [ |
| 348 | 'name' => 'index_entity', |
| 349 | 'field' => [ |
| 350 | 0 => 'entity_table', |
| 351 | 1 => 'entity_id', |
| 352 | ], |
| 353 | 'localizable' => FALSE, |
| 354 | 'sig' => 'civicrm_pledge_block::0::entity_table::entity_id', |
| 355 | ], |
| 356 | ]; |
| 357 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 358 | } |
| 359 | |
| 360 | } |