5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contribute/ContributionSoft.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e6e9714690d71b36fc982ba2215fc0a1)
13 * Database access object for the ContributionSoft entity.
15 class CRM_Contribute_DAO_ContributionSoft
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.2';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_contribution_soft';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
42 * FK to contribution table.
46 public $contribution_id;
56 * Amount of this soft credit.
63 * 3 character string, value from config setting or input via user.
70 * FK to civicrm_pcp.id
79 public $pcp_display_in_roll;
84 public $pcp_roll_nickname;
89 public $pcp_personal_note;
92 * Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.
96 public $soft_credit_type_id;
101 public function __construct() {
102 $this->__table
= 'civicrm_contribution_soft';
103 parent
::__construct();
107 * Returns localized title of this entity.
109 * @param bool $plural
110 * Whether to return the plural version of the title.
112 public static function getEntityTitle($plural = FALSE) {
113 return $plural ?
ts('Contribution Soft Credits') : ts('Contribution Soft Credit');
117 * Returns foreign keys and entity references.
120 * [CRM_Core_Reference_Interface]
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_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
126 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
127 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'pcp_id', 'civicrm_pcp', 'id');
128 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
130 return Civi
::$statics[__CLASS__
]['links'];
134 * Returns all the column names of this table
138 public static function &fields() {
139 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
140 Civi
::$statics[__CLASS__
]['fields'] = [
141 'contribution_soft_id' => [
143 'type' => CRM_Utils_Type
::T_INT
,
144 'title' => ts('Soft Credit ID'),
145 'description' => ts('Soft Credit ID'),
148 'where' => 'civicrm_contribution_soft.id',
150 'table_name' => 'civicrm_contribution_soft',
151 'entity' => 'ContributionSoft',
152 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
160 'contribution_id' => [
161 'name' => 'contribution_id',
162 'type' => CRM_Utils_Type
::T_INT
,
163 'title' => ts('Contribution ID'),
164 'description' => ts('FK to contribution table.'),
166 'where' => 'civicrm_contribution_soft.contribution_id',
167 'table_name' => 'civicrm_contribution_soft',
168 'entity' => 'ContributionSoft',
169 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
171 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
173 'label' => ts("Contribution"),
177 'contribution_soft_contact_id' => [
178 'name' => 'contact_id',
179 'type' => CRM_Utils_Type
::T_INT
,
180 'title' => ts('Contact ID'),
181 'description' => ts('FK to Contact ID'),
184 'where' => 'civicrm_contribution_soft.contact_id',
185 'headerPattern' => '/contact(.?id)?/i',
186 'dataPattern' => '/^\d+$/',
188 'table_name' => 'civicrm_contribution_soft',
189 'entity' => 'ContributionSoft',
190 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
192 'FKClassName' => 'CRM_Contact_DAO_Contact',
194 'label' => ts("Contact"),
200 'type' => CRM_Utils_Type
::T_MONEY
,
201 'title' => ts('Soft Credit Amount'),
202 'description' => ts('Amount of this soft credit.'),
209 'where' => 'civicrm_contribution_soft.amount',
210 'headerPattern' => '/total(.?am(ou)?nt)?/i',
211 'dataPattern' => '/^\d+(\.\d{2})?$/',
213 'table_name' => 'civicrm_contribution_soft',
214 'entity' => 'ContributionSoft',
215 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
220 'name' => 'currency',
221 'type' => CRM_Utils_Type
::T_STRING
,
222 'title' => ts('Soft Contribution Currency'),
223 'description' => ts('3 character string, value from config setting or input via user.'),
225 'size' => CRM_Utils_Type
::FOUR
,
226 'where' => 'civicrm_contribution_soft.currency',
228 'table_name' => 'civicrm_contribution_soft',
229 'entity' => 'ContributionSoft',
230 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
235 'pseudoconstant' => [
236 'table' => 'civicrm_currency',
237 'keyColumn' => 'name',
238 'labelColumn' => 'full_name',
239 'nameColumn' => 'name',
240 'abbrColumn' => 'symbol',
246 'type' => CRM_Utils_Type
::T_INT
,
247 'title' => ts('PCP ID'),
248 'description' => ts('FK to civicrm_pcp.id'),
249 'where' => 'civicrm_contribution_soft.pcp_id',
251 'table_name' => 'civicrm_contribution_soft',
252 'entity' => 'ContributionSoft',
253 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
255 'FKClassName' => 'CRM_PCP_DAO_PCP',
257 'label' => ts("PCP"),
259 'pseudoconstant' => [
260 'table' => 'civicrm_pcp',
262 'labelColumn' => 'title',
266 'pcp_display_in_roll' => [
267 'name' => 'pcp_display_in_roll',
268 'type' => CRM_Utils_Type
::T_BOOLEAN
,
269 'title' => ts('Soft Contribution Display on PCP'),
270 'where' => 'civicrm_contribution_soft.pcp_display_in_roll',
272 'table_name' => 'civicrm_contribution_soft',
273 'entity' => 'ContributionSoft',
274 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
278 'pcp_roll_nickname' => [
279 'name' => 'pcp_roll_nickname',
280 'type' => CRM_Utils_Type
::T_STRING
,
281 'title' => ts('Soft Contribution PCP Nickname'),
283 'size' => CRM_Utils_Type
::HUGE
,
284 'where' => 'civicrm_contribution_soft.pcp_roll_nickname',
286 'table_name' => 'civicrm_contribution_soft',
287 'entity' => 'ContributionSoft',
288 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
292 'pcp_personal_note' => [
293 'name' => 'pcp_personal_note',
294 'type' => CRM_Utils_Type
::T_STRING
,
295 'title' => ts('Soft Contribution PCP Note'),
297 'size' => CRM_Utils_Type
::HUGE
,
298 'where' => 'civicrm_contribution_soft.pcp_personal_note',
300 'table_name' => 'civicrm_contribution_soft',
301 'entity' => 'ContributionSoft',
302 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
305 'type' => 'TextArea',
309 'soft_credit_type_id' => [
310 'name' => 'soft_credit_type_id',
311 'type' => CRM_Utils_Type
::T_INT
,
312 'title' => ts('Soft Credit Type'),
313 'description' => ts('Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.'),
314 'where' => 'civicrm_contribution_soft.soft_credit_type_id',
316 'table_name' => 'civicrm_contribution_soft',
317 'entity' => 'ContributionSoft',
318 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
320 'pseudoconstant' => [
321 'optionGroupName' => 'soft_credit_type',
322 'optionEditPath' => 'civicrm/admin/options/soft_credit_type',
327 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
329 return Civi
::$statics[__CLASS__
]['fields'];
333 * Return a mapping from field-name to the corresponding key (as used in fields()).
336 * Array(string $name => string $uniqueName).
338 public static function &fieldKeys() {
339 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
340 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
342 return Civi
::$statics[__CLASS__
]['fieldKeys'];
346 * Returns the names of this table
350 public static function getTableName() {
351 return self
::$_tableName;
355 * Returns if this table needs to be logged
359 public function getLog() {
364 * Returns the list of fields that can be imported
366 * @param bool $prefix
370 public static function &import($prefix = FALSE) {
371 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_soft', $prefix, []);
376 * Returns the list of fields that can be exported
378 * @param bool $prefix
382 public static function &export($prefix = FALSE) {
383 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_soft', $prefix, []);
388 * Returns the list of indices
390 * @param bool $localize
394 public static function indices($localize = TRUE) {
397 'name' => 'index_id',
401 'localizable' => FALSE,
402 'sig' => 'civicrm_contribution_soft::0::pcp_id',
405 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;