5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Member/MembershipPayment.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ff33ff800a373cf9cf5e58ad1d5a3c94)
13 * Database access object for the MembershipPayment entity.
15 class CRM_Member_DAO_MembershipPayment
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.5';
18 const COMPONENT
= 'CiviMember';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_membership_payment';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
42 * FK to Membership table
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
48 public $membership_id;
51 * FK to contribution table.
53 * @var int|string|null
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
57 public $contribution_id;
62 public function __construct() {
63 $this->__table
= 'civicrm_membership_payment';
64 parent
::__construct();
68 * Returns localized title of this entity.
71 * Whether to return the plural version of the title.
73 public static function getEntityTitle($plural = FALSE) {
74 return $plural ?
ts('Membership Payments') : ts('Membership Payment');
78 * Returns foreign keys and entity references.
81 * [CRM_Core_Reference_Interface]
83 public static function getReferenceColumns() {
84 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
85 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
86 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'membership_id', 'civicrm_membership', 'id');
87 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
88 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
90 return Civi
::$statics[__CLASS__
]['links'];
94 * Returns all the column names of this table
98 public static function &fields() {
99 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
100 Civi
::$statics[__CLASS__
]['fields'] = [
103 'type' => CRM_Utils_Type
::T_INT
,
104 'title' => ts('Membership Payment ID'),
106 'where' => 'civicrm_membership_payment.id',
107 'table_name' => 'civicrm_membership_payment',
108 'entity' => 'MembershipPayment',
109 'bao' => 'CRM_Member_BAO_MembershipPayment',
118 'name' => 'membership_id',
119 'type' => CRM_Utils_Type
::T_INT
,
120 'title' => ts('Membership ID'),
121 'description' => ts('FK to Membership table'),
123 'where' => 'civicrm_membership_payment.membership_id',
124 'table_name' => 'civicrm_membership_payment',
125 'entity' => 'MembershipPayment',
126 'bao' => 'CRM_Member_BAO_MembershipPayment',
128 'FKClassName' => 'CRM_Member_DAO_Membership',
130 'label' => ts("Membership"),
134 'contribution_id' => [
135 'name' => 'contribution_id',
136 'type' => CRM_Utils_Type
::T_INT
,
137 'title' => ts('Contribution ID'),
138 'description' => ts('FK to contribution table.'),
139 'where' => 'civicrm_membership_payment.contribution_id',
140 'table_name' => 'civicrm_membership_payment',
141 'entity' => 'MembershipPayment',
142 'bao' => 'CRM_Member_BAO_MembershipPayment',
144 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
146 'label' => ts("Contribution"),
151 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
153 return Civi
::$statics[__CLASS__
]['fields'];
157 * Return a mapping from field-name to the corresponding key (as used in fields()).
160 * Array(string $name => string $uniqueName).
162 public static function &fieldKeys() {
163 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
164 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
166 return Civi
::$statics[__CLASS__
]['fieldKeys'];
170 * Returns the names of this table
174 public static function getTableName() {
175 return self
::$_tableName;
179 * Returns if this table needs to be logged
183 public function getLog() {
188 * Returns the list of fields that can be imported
190 * @param bool $prefix
194 public static function &import($prefix = FALSE) {
195 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_payment', $prefix, []);
200 * Returns the list of fields that can be exported
202 * @param bool $prefix
206 public static function &export($prefix = FALSE) {
207 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_payment', $prefix, []);
212 * Returns the list of indices
214 * @param bool $localize
218 public static function indices($localize = TRUE) {
220 'UI_contribution_membership' => [
221 'name' => 'UI_contribution_membership',
223 0 => 'contribution_id',
224 1 => 'membership_id',
226 'localizable' => FALSE,
228 'sig' => 'civicrm_membership_payment::1::contribution_id::membership_id',
231 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;