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:9d890f5a0f0efc24ce1adaf5c84ac54e)
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;
37 * @var int|string|null
38 * (SQL type: int unsigned)
39 * Note that values will be retrieved from the database as a string.
44 * FK to contribution table.
47 * (SQL type: int unsigned)
48 * Note that values will be retrieved from the database as a string.
50 public $contribution_id;
56 * (SQL type: int unsigned)
57 * Note that values will be retrieved from the database as a string.
62 * Amount of this soft credit.
65 * (SQL type: decimal(20,2))
66 * Note that values will be retrieved from the database as a string.
71 * 3 character string, value from config setting or input via user.
74 * (SQL type: varchar(3))
75 * Note that values will be retrieved from the database as a string.
80 * FK to civicrm_pcp.id
82 * @var int|string|null
83 * (SQL type: int unsigned)
84 * Note that values will be retrieved from the database as a string.
91 * Note that values will be retrieved from the database as a string.
93 public $pcp_display_in_roll;
97 * (SQL type: varchar(255))
98 * Note that values will be retrieved from the database as a string.
100 public $pcp_roll_nickname;
104 * (SQL type: varchar(255))
105 * Note that values will be retrieved from the database as a string.
107 public $pcp_personal_note;
110 * Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.
112 * @var int|string|null
113 * (SQL type: int unsigned)
114 * Note that values will be retrieved from the database as a string.
116 public $soft_credit_type_id;
121 public function __construct() {
122 $this->__table
= 'civicrm_contribution_soft';
123 parent
::__construct();
127 * Returns localized title of this entity.
129 * @param bool $plural
130 * Whether to return the plural version of the title.
132 public static function getEntityTitle($plural = FALSE) {
133 return $plural ?
ts('Contribution Soft Credits') : ts('Contribution Soft Credit');
137 * Returns foreign keys and entity references.
140 * [CRM_Core_Reference_Interface]
142 public static function getReferenceColumns() {
143 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
144 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
145 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
146 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
147 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'pcp_id', 'civicrm_pcp', 'id');
148 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
150 return Civi
::$statics[__CLASS__
]['links'];
154 * Returns all the column names of this table
158 public static function &fields() {
159 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
160 Civi
::$statics[__CLASS__
]['fields'] = [
161 'contribution_soft_id' => [
163 'type' => CRM_Utils_Type
::T_INT
,
164 'title' => ts('Soft Credit ID'),
165 'description' => ts('Soft Credit ID'),
168 'where' => 'civicrm_contribution_soft.id',
170 'table_name' => 'civicrm_contribution_soft',
171 'entity' => 'ContributionSoft',
172 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
180 'contribution_id' => [
181 'name' => 'contribution_id',
182 'type' => CRM_Utils_Type
::T_INT
,
183 'title' => ts('Contribution ID'),
184 'description' => ts('FK to contribution table.'),
186 'where' => 'civicrm_contribution_soft.contribution_id',
187 'table_name' => 'civicrm_contribution_soft',
188 'entity' => 'ContributionSoft',
189 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
191 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
193 'label' => ts("Contribution"),
197 'contribution_soft_contact_id' => [
198 'name' => 'contact_id',
199 'type' => CRM_Utils_Type
::T_INT
,
200 'title' => ts('Contact ID'),
201 'description' => ts('FK to Contact ID'),
204 'where' => 'civicrm_contribution_soft.contact_id',
205 'headerPattern' => '/contact(.?id)?/i',
206 'dataPattern' => '/^\d+$/',
208 'table_name' => 'civicrm_contribution_soft',
209 'entity' => 'ContributionSoft',
210 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
212 'FKClassName' => 'CRM_Contact_DAO_Contact',
214 'label' => ts("Contact"),
220 'type' => CRM_Utils_Type
::T_MONEY
,
221 'title' => ts('Soft Credit Amount'),
222 'description' => ts('Amount of this soft credit.'),
229 'where' => 'civicrm_contribution_soft.amount',
230 'headerPattern' => '/total(.?am(ou)?nt)?/i',
231 'dataPattern' => '/^\d+(\.\d{2})?$/',
233 'table_name' => 'civicrm_contribution_soft',
234 'entity' => 'ContributionSoft',
235 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
240 'name' => 'currency',
241 'type' => CRM_Utils_Type
::T_STRING
,
242 'title' => ts('Soft Contribution Currency'),
243 'description' => ts('3 character string, value from config setting or input via user.'),
245 'size' => CRM_Utils_Type
::FOUR
,
246 'where' => 'civicrm_contribution_soft.currency',
248 'table_name' => 'civicrm_contribution_soft',
249 'entity' => 'ContributionSoft',
250 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
255 'pseudoconstant' => [
256 'table' => 'civicrm_currency',
257 'keyColumn' => 'name',
258 'labelColumn' => 'full_name',
259 'nameColumn' => 'name',
260 'abbrColumn' => 'symbol',
266 'type' => CRM_Utils_Type
::T_INT
,
267 'title' => ts('PCP ID'),
268 'description' => ts('FK to civicrm_pcp.id'),
269 'where' => 'civicrm_contribution_soft.pcp_id',
271 'table_name' => 'civicrm_contribution_soft',
272 'entity' => 'ContributionSoft',
273 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
275 'FKClassName' => 'CRM_PCP_DAO_PCP',
277 'label' => ts("PCP"),
279 'pseudoconstant' => [
280 'table' => 'civicrm_pcp',
282 'labelColumn' => 'title',
286 'pcp_display_in_roll' => [
287 'name' => 'pcp_display_in_roll',
288 'type' => CRM_Utils_Type
::T_BOOLEAN
,
289 'title' => ts('Soft Contribution Display on PCP'),
291 'where' => 'civicrm_contribution_soft.pcp_display_in_roll',
293 'table_name' => 'civicrm_contribution_soft',
294 'entity' => 'ContributionSoft',
295 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
299 'pcp_roll_nickname' => [
300 'name' => 'pcp_roll_nickname',
301 'type' => CRM_Utils_Type
::T_STRING
,
302 'title' => ts('Soft Contribution PCP Nickname'),
304 'size' => CRM_Utils_Type
::HUGE
,
305 'where' => 'civicrm_contribution_soft.pcp_roll_nickname',
307 'table_name' => 'civicrm_contribution_soft',
308 'entity' => 'ContributionSoft',
309 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
313 'pcp_personal_note' => [
314 'name' => 'pcp_personal_note',
315 'type' => CRM_Utils_Type
::T_STRING
,
316 'title' => ts('Soft Contribution PCP Note'),
318 'size' => CRM_Utils_Type
::HUGE
,
319 'where' => 'civicrm_contribution_soft.pcp_personal_note',
321 'table_name' => 'civicrm_contribution_soft',
322 'entity' => 'ContributionSoft',
323 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
326 'type' => 'TextArea',
330 'soft_credit_type_id' => [
331 'name' => 'soft_credit_type_id',
332 'type' => CRM_Utils_Type
::T_INT
,
333 'title' => ts('Soft Credit Type'),
334 'description' => ts('Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.'),
335 'where' => 'civicrm_contribution_soft.soft_credit_type_id',
337 'table_name' => 'civicrm_contribution_soft',
338 'entity' => 'ContributionSoft',
339 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
341 'pseudoconstant' => [
342 'optionGroupName' => 'soft_credit_type',
343 'optionEditPath' => 'civicrm/admin/options/soft_credit_type',
348 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
350 return Civi
::$statics[__CLASS__
]['fields'];
354 * Return a mapping from field-name to the corresponding key (as used in fields()).
357 * Array(string $name => string $uniqueName).
359 public static function &fieldKeys() {
360 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
361 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
363 return Civi
::$statics[__CLASS__
]['fieldKeys'];
367 * Returns the names of this table
371 public static function getTableName() {
372 return self
::$_tableName;
376 * Returns if this table needs to be logged
380 public function getLog() {
385 * Returns the list of fields that can be imported
387 * @param bool $prefix
391 public static function &import($prefix = FALSE) {
392 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_soft', $prefix, []);
397 * Returns the list of fields that can be exported
399 * @param bool $prefix
403 public static function &export($prefix = FALSE) {
404 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_soft', $prefix, []);
409 * Returns the list of indices
411 * @param bool $localize
415 public static function indices($localize = TRUE) {
418 'name' => 'index_id',
422 'localizable' => FALSE,
423 'sig' => 'civicrm_contribution_soft::0::pcp_id',
426 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;