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:13ea3cb5cb23675acf2be4667deb1e45)
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',
156 'contribution_id' => [
157 'name' => 'contribution_id',
158 'type' => CRM_Utils_Type
::T_INT
,
159 'title' => ts('Soft Credit - Contribution ID'),
160 'description' => ts('FK to contribution table.'),
162 'where' => 'civicrm_contribution_soft.contribution_id',
163 'table_name' => 'civicrm_contribution_soft',
164 'entity' => 'ContributionSoft',
165 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
167 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
170 'contribution_soft_contact_id' => [
171 'name' => 'contact_id',
172 'type' => CRM_Utils_Type
::T_INT
,
173 'title' => ts('Soft Credit Contact ID'),
174 'description' => ts('FK to Contact ID'),
177 'where' => 'civicrm_contribution_soft.contact_id',
178 'headerPattern' => '/contact(.?id)?/i',
179 'dataPattern' => '/^\d+$/',
181 'table_name' => 'civicrm_contribution_soft',
182 'entity' => 'ContributionSoft',
183 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
185 'FKClassName' => 'CRM_Contact_DAO_Contact',
190 'type' => CRM_Utils_Type
::T_MONEY
,
191 'title' => ts('Soft Credit Amount'),
192 'description' => ts('Amount of this soft credit.'),
199 'where' => 'civicrm_contribution_soft.amount',
200 'headerPattern' => '/total(.?am(ou)?nt)?/i',
201 'dataPattern' => '/^\d+(\.\d{2})?$/',
203 'table_name' => 'civicrm_contribution_soft',
204 'entity' => 'ContributionSoft',
205 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
210 'name' => 'currency',
211 'type' => CRM_Utils_Type
::T_STRING
,
212 'title' => ts('Soft Contribution Currency'),
213 'description' => ts('3 character string, value from config setting or input via user.'),
215 'size' => CRM_Utils_Type
::FOUR
,
216 'where' => 'civicrm_contribution_soft.currency',
218 'table_name' => 'civicrm_contribution_soft',
219 'entity' => 'ContributionSoft',
220 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
225 'pseudoconstant' => [
226 'table' => 'civicrm_currency',
227 'keyColumn' => 'name',
228 'labelColumn' => 'full_name',
229 'nameColumn' => 'name',
230 'abbrColumn' => 'symbol',
236 'type' => CRM_Utils_Type
::T_INT
,
237 'title' => ts('Soft Contribution PCP'),
238 'description' => ts('FK to civicrm_pcp.id'),
239 'where' => 'civicrm_contribution_soft.pcp_id',
241 'table_name' => 'civicrm_contribution_soft',
242 'entity' => 'ContributionSoft',
243 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
245 'FKClassName' => 'CRM_PCP_DAO_PCP',
246 'pseudoconstant' => [
247 'table' => 'civicrm_pcp',
249 'labelColumn' => 'title',
253 'pcp_display_in_roll' => [
254 'name' => 'pcp_display_in_roll',
255 'type' => CRM_Utils_Type
::T_BOOLEAN
,
256 'title' => ts('Soft Contribution Display on PCP'),
257 'where' => 'civicrm_contribution_soft.pcp_display_in_roll',
259 'table_name' => 'civicrm_contribution_soft',
260 'entity' => 'ContributionSoft',
261 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
265 'pcp_roll_nickname' => [
266 'name' => 'pcp_roll_nickname',
267 'type' => CRM_Utils_Type
::T_STRING
,
268 'title' => ts('Soft Contribution PCP Nickname'),
270 'size' => CRM_Utils_Type
::HUGE
,
271 'where' => 'civicrm_contribution_soft.pcp_roll_nickname',
273 'table_name' => 'civicrm_contribution_soft',
274 'entity' => 'ContributionSoft',
275 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
279 'pcp_personal_note' => [
280 'name' => 'pcp_personal_note',
281 'type' => CRM_Utils_Type
::T_STRING
,
282 'title' => ts('Soft Contribution PCP Note'),
284 'size' => CRM_Utils_Type
::HUGE
,
285 'where' => 'civicrm_contribution_soft.pcp_personal_note',
287 'table_name' => 'civicrm_contribution_soft',
288 'entity' => 'ContributionSoft',
289 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
292 'type' => 'TextArea',
296 'soft_credit_type_id' => [
297 'name' => 'soft_credit_type_id',
298 'type' => CRM_Utils_Type
::T_INT
,
299 'title' => ts('Soft Credit Type'),
300 'description' => ts('Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.'),
301 'where' => 'civicrm_contribution_soft.soft_credit_type_id',
303 'table_name' => 'civicrm_contribution_soft',
304 'entity' => 'ContributionSoft',
305 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
307 'pseudoconstant' => [
308 'optionGroupName' => 'soft_credit_type',
309 'optionEditPath' => 'civicrm/admin/options/soft_credit_type',
314 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
316 return Civi
::$statics[__CLASS__
]['fields'];
320 * Return a mapping from field-name to the corresponding key (as used in fields()).
323 * Array(string $name => string $uniqueName).
325 public static function &fieldKeys() {
326 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
327 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
329 return Civi
::$statics[__CLASS__
]['fieldKeys'];
333 * Returns the names of this table
337 public static function getTableName() {
338 return self
::$_tableName;
342 * Returns if this table needs to be logged
346 public function getLog() {
351 * Returns the list of fields that can be imported
353 * @param bool $prefix
357 public static function &import($prefix = FALSE) {
358 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_soft', $prefix, []);
363 * Returns the list of fields that can be exported
365 * @param bool $prefix
369 public static function &export($prefix = FALSE) {
370 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_soft', $prefix, []);
375 * Returns the list of indices
377 * @param bool $localize
381 public static function indices($localize = TRUE) {
384 'name' => 'index_id',
388 'localizable' => FALSE,
389 'sig' => 'civicrm_contribution_soft::0::pcp_id',
392 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;