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