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