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