Merge pull request #15475 from mecachisenros/externUrl
[civicrm-core.git] / CRM / Member / DAO / MembershipPayment.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Member/MembershipPayment.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
f29bf4f3 9 * (GenCodeChecksum:4bff4dffec3c3a766c34f49eb96ece19)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the MembershipPayment entity.
f41f0342 14 */
e501603b 15class CRM_Member_DAO_MembershipPayment extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_membership_payment';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = TRUE;
c3fc2621 30
e501603b 31 /**
e6ca0a57 32 * @var int
e501603b
TO
33 */
34 public $id;
c3fc2621 35
e501603b
TO
36 /**
37 * FK to Membership table
38 *
e6ca0a57 39 * @var int
e501603b
TO
40 */
41 public $membership_id;
c3fc2621 42
e501603b
TO
43 /**
44 * FK to contribution table.
45 *
e6ca0a57 46 * @var int
e501603b
TO
47 */
48 public $contribution_id;
c3fc2621 49
e501603b 50 /**
f41f0342 51 * Class constructor.
e501603b 52 */
c3fc2621 53 public function __construct() {
e501603b
TO
54 $this->__table = 'civicrm_membership_payment';
55 parent::__construct();
56 }
c3fc2621 57
e501603b 58 /**
f41f0342 59 * Returns foreign keys and entity references.
e501603b
TO
60 *
61 * @return array
62 * [CRM_Core_Reference_Interface]
63 */
c3fc2621 64 public static function getReferenceColumns() {
346aaaba 65 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 66 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
67 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_id', 'civicrm_membership', 'id');
68 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
346aaaba 69 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 70 }
346aaaba 71 return Civi::$statics[__CLASS__]['links'];
e501603b 72 }
c3fc2621 73
e501603b
TO
74 /**
75 * Returns all the column names of this table
76 *
77 * @return array
78 */
c3fc2621 79 public static function &fields() {
346aaaba 80 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
81 Civi::$statics[__CLASS__]['fields'] = [
82 'id' => [
e501603b
TO
83 'name' => 'id',
84 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
85 'title' => ts('Membership Payment ID'),
86 'required' => TRUE,
a36434b9 87 'where' => 'civicrm_membership_payment.id',
522a26c9 88 'table_name' => 'civicrm_membership_payment',
89 'entity' => 'MembershipPayment',
90 'bao' => 'CRM_Member_BAO_MembershipPayment',
6a7e5e5d 91 'localizable' => 0,
c3fc2621
CW
92 ],
93 'membership_id' => [
e501603b
TO
94 'name' => 'membership_id',
95 'type' => CRM_Utils_Type::T_INT,
c3fc2621 96 'title' => ts('Membership'),
215b423e 97 'description' => ts('FK to Membership table'),
c3fc2621 98 'required' => TRUE,
a36434b9 99 'where' => 'civicrm_membership_payment.membership_id',
522a26c9 100 'table_name' => 'civicrm_membership_payment',
101 'entity' => 'MembershipPayment',
102 'bao' => 'CRM_Member_BAO_MembershipPayment',
6a7e5e5d 103 'localizable' => 0,
e501603b 104 'FKClassName' => 'CRM_Member_DAO_Membership',
c3fc2621
CW
105 ],
106 'contribution_id' => [
e501603b
TO
107 'name' => 'contribution_id',
108 'type' => CRM_Utils_Type::T_INT,
c3fc2621 109 'title' => ts('Contribution'),
215b423e 110 'description' => ts('FK to contribution table.'),
a36434b9 111 'where' => 'civicrm_membership_payment.contribution_id',
522a26c9 112 'table_name' => 'civicrm_membership_payment',
113 'entity' => 'MembershipPayment',
114 'bao' => 'CRM_Member_BAO_MembershipPayment',
6a7e5e5d 115 'localizable' => 0,
e501603b 116 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
c3fc2621
CW
117 ],
118 ];
346aaaba 119 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 120 }
346aaaba 121 return Civi::$statics[__CLASS__]['fields'];
e501603b 122 }
c3fc2621 123
e501603b 124 /**
bd8e0b14 125 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
126 *
127 * @return array
bd8e0b14 128 * Array(string $name => string $uniqueName).
e501603b 129 */
c3fc2621 130 public static function &fieldKeys() {
bd8e0b14
TO
131 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
132 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 133 }
bd8e0b14 134 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 135 }
c3fc2621 136
e501603b
TO
137 /**
138 * Returns the names of this table
139 *
140 * @return string
141 */
c3fc2621 142 public static function getTableName() {
e501603b
TO
143 return self::$_tableName;
144 }
c3fc2621 145
e501603b
TO
146 /**
147 * Returns if this table needs to be logged
148 *
c3fc2621 149 * @return bool
e501603b 150 */
c3fc2621 151 public function getLog() {
e501603b
TO
152 return self::$_log;
153 }
c3fc2621 154
e501603b
TO
155 /**
156 * Returns the list of fields that can be imported
157 *
158 * @param bool $prefix
159 *
160 * @return array
161 */
c3fc2621
CW
162 public static function &import($prefix = FALSE) {
163 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_payment', $prefix, []);
60808919 164 return $r;
e501603b 165 }
c3fc2621 166
e501603b
TO
167 /**
168 * Returns the list of fields that can be exported
169 *
170 * @param bool $prefix
171 *
172 * @return array
173 */
c3fc2621
CW
174 public static function &export($prefix = FALSE) {
175 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_payment', $prefix, []);
60808919 176 return $r;
e501603b 177 }
c3fc2621 178
e7a6b91a
AS
179 /**
180 * Returns the list of indices
c3fc2621
CW
181 *
182 * @param bool $localize
183 *
184 * @return array
e7a6b91a
AS
185 */
186 public static function indices($localize = TRUE) {
c3fc2621
CW
187 $indices = [
188 'UI_contribution_membership' => [
e7a6b91a 189 'name' => 'UI_contribution_membership',
c3fc2621 190 'field' => [
e7a6b91a
AS
191 0 => 'contribution_id',
192 1 => 'membership_id',
c3fc2621
CW
193 ],
194 'localizable' => FALSE,
195 'unique' => TRUE,
e7a6b91a 196 'sig' => 'civicrm_membership_payment::1::contribution_id::membership_id',
c3fc2621
CW
197 ],
198 ];
e7a6b91a
AS
199 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
200 }
c3fc2621 201
e501603b 202}