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