Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Financial/EntityFinancialTrxn.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 9 | * (GenCodeChecksum:8650c2685e9d125bed6f9b65ce208621) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the EntityFinancialTrxn entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
22 | static $_tableName = 'civicrm_entity_financial_trxn'; | |
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 | */ |
c3fc2621 CW |
29 | static $_log = FALSE; |
30 | ||
e501603b TO |
31 | /** |
32 | * ID | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | public $entity_table; | |
c3fc2621 | 44 | |
e501603b | 45 | /** |
e501603b TO |
46 | * @var int unsigned |
47 | */ | |
48 | public $entity_id; | |
c3fc2621 | 49 | |
e501603b | 50 | /** |
e501603b TO |
51 | * @var int unsigned |
52 | */ | |
53 | public $financial_trxn_id; | |
c3fc2621 | 54 | |
e501603b TO |
55 | /** |
56 | * allocated amount of transaction to this entity | |
57 | * | |
58 | * @var float | |
59 | */ | |
60 | public $amount; | |
c3fc2621 | 61 | |
e501603b | 62 | /** |
f41f0342 | 63 | * Class constructor. |
e501603b | 64 | */ |
c3fc2621 | 65 | public function __construct() { |
e501603b TO |
66 | $this->__table = 'civicrm_entity_financial_trxn'; |
67 | parent::__construct(); | |
68 | } | |
c3fc2621 | 69 | |
e501603b | 70 | /** |
f41f0342 | 71 | * Returns foreign keys and entity references. |
e501603b TO |
72 | * |
73 | * @return array | |
74 | * [CRM_Core_Reference_Interface] | |
75 | */ | |
c3fc2621 | 76 | public static function getReferenceColumns() { |
346aaaba TO |
77 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
78 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
c3fc2621 CW |
79 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_trxn_id', 'civicrm_financial_trxn', 'id'); |
80 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); | |
346aaaba | 81 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 82 | } |
346aaaba | 83 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 84 | } |
c3fc2621 | 85 | |
e501603b TO |
86 | /** |
87 | * Returns all the column names of this table | |
88 | * | |
89 | * @return array | |
90 | */ | |
c3fc2621 | 91 | public static function &fields() { |
346aaaba | 92 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
93 | Civi::$statics[__CLASS__]['fields'] = [ |
94 | 'id' => [ | |
e501603b TO |
95 | 'name' => 'id', |
96 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 97 | 'title' => ts('Entity Financial Transaction ID'), |
215b423e | 98 | 'description' => ts('ID'), |
c3fc2621 | 99 | 'required' => TRUE, |
522a26c9 | 100 | 'table_name' => 'civicrm_entity_financial_trxn', |
101 | 'entity' => 'EntityFinancialTrxn', | |
102 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
6a7e5e5d | 103 | 'localizable' => 0, |
c3fc2621 CW |
104 | ], |
105 | 'entity_table' => [ | |
e501603b TO |
106 | 'name' => 'entity_table', |
107 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 108 | 'title' => ts('Entity Table'), |
215b423e | 109 | 'description' => ts('May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc'), |
c3fc2621 | 110 | 'required' => TRUE, |
e501603b TO |
111 | 'maxlength' => 64, |
112 | 'size' => CRM_Utils_Type::BIG, | |
c3fc2621 | 113 | 'import' => TRUE, |
e501603b TO |
114 | 'where' => 'civicrm_entity_financial_trxn.entity_table', |
115 | 'headerPattern' => '', | |
116 | 'dataPattern' => '', | |
c3fc2621 | 117 | 'export' => TRUE, |
522a26c9 | 118 | 'table_name' => 'civicrm_entity_financial_trxn', |
119 | 'entity' => 'EntityFinancialTrxn', | |
120 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
6a7e5e5d | 121 | 'localizable' => 0, |
c3fc2621 CW |
122 | ], |
123 | 'entity_id' => [ | |
e501603b TO |
124 | 'name' => 'entity_id', |
125 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
126 | 'title' => ts('Entity ID'), |
127 | 'required' => TRUE, | |
522a26c9 | 128 | 'table_name' => 'civicrm_entity_financial_trxn', |
129 | 'entity' => 'EntityFinancialTrxn', | |
130 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
6a7e5e5d | 131 | 'localizable' => 0, |
c3fc2621 CW |
132 | ], |
133 | 'financial_trxn_id' => [ | |
e501603b TO |
134 | 'name' => 'financial_trxn_id', |
135 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 136 | 'title' => ts('Financial Transaction Id'), |
522a26c9 | 137 | 'table_name' => 'civicrm_entity_financial_trxn', |
138 | 'entity' => 'EntityFinancialTrxn', | |
139 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
6a7e5e5d | 140 | 'localizable' => 0, |
e501603b | 141 | 'FKClassName' => 'CRM_Financial_DAO_FinancialTrxn', |
c3fc2621 CW |
142 | ], |
143 | 'amount' => [ | |
e501603b TO |
144 | 'name' => 'amount', |
145 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 146 | 'title' => ts('Amount'), |
215b423e | 147 | 'description' => ts('allocated amount of transaction to this entity'), |
c3fc2621 CW |
148 | 'required' => TRUE, |
149 | 'precision' => [ | |
e501603b TO |
150 | 20, |
151 | 2 | |
c3fc2621 CW |
152 | ], |
153 | 'import' => TRUE, | |
e501603b TO |
154 | 'where' => 'civicrm_entity_financial_trxn.amount', |
155 | 'headerPattern' => '/amount/i', | |
156 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
c3fc2621 | 157 | 'export' => TRUE, |
522a26c9 | 158 | 'table_name' => 'civicrm_entity_financial_trxn', |
159 | 'entity' => 'EntityFinancialTrxn', | |
160 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
6a7e5e5d | 161 | 'localizable' => 0, |
c3fc2621 CW |
162 | ], |
163 | ]; | |
346aaaba | 164 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 165 | } |
346aaaba | 166 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 167 | } |
c3fc2621 | 168 | |
e501603b | 169 | /** |
bd8e0b14 | 170 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
171 | * |
172 | * @return array | |
bd8e0b14 | 173 | * Array(string $name => string $uniqueName). |
e501603b | 174 | */ |
c3fc2621 | 175 | public static function &fieldKeys() { |
bd8e0b14 TO |
176 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
177 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 178 | } |
bd8e0b14 | 179 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 180 | } |
c3fc2621 | 181 | |
e501603b TO |
182 | /** |
183 | * Returns the names of this table | |
184 | * | |
185 | * @return string | |
186 | */ | |
c3fc2621 | 187 | public static function getTableName() { |
e501603b TO |
188 | return self::$_tableName; |
189 | } | |
c3fc2621 | 190 | |
e501603b TO |
191 | /** |
192 | * Returns if this table needs to be logged | |
193 | * | |
c3fc2621 | 194 | * @return bool |
e501603b | 195 | */ |
c3fc2621 | 196 | public function getLog() { |
e501603b TO |
197 | return self::$_log; |
198 | } | |
c3fc2621 | 199 | |
e501603b TO |
200 | /** |
201 | * Returns the list of fields that can be imported | |
202 | * | |
203 | * @param bool $prefix | |
204 | * | |
205 | * @return array | |
206 | */ | |
c3fc2621 CW |
207 | public static function &import($prefix = FALSE) { |
208 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_trxn', $prefix, []); | |
60808919 | 209 | return $r; |
e501603b | 210 | } |
c3fc2621 | 211 | |
e501603b TO |
212 | /** |
213 | * Returns the list of fields that can be exported | |
214 | * | |
215 | * @param bool $prefix | |
216 | * | |
217 | * @return array | |
218 | */ | |
c3fc2621 CW |
219 | public static function &export($prefix = FALSE) { |
220 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_trxn', $prefix, []); | |
60808919 | 221 | return $r; |
e501603b | 222 | } |
c3fc2621 | 223 | |
e7a6b91a AS |
224 | /** |
225 | * Returns the list of indices | |
c3fc2621 CW |
226 | * |
227 | * @param bool $localize | |
228 | * | |
229 | * @return array | |
e7a6b91a AS |
230 | */ |
231 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
232 | $indices = [ |
233 | 'UI_entity_financial_trxn_entity_table' => [ | |
e7a6b91a | 234 | 'name' => 'UI_entity_financial_trxn_entity_table', |
c3fc2621 | 235 | 'field' => [ |
e7a6b91a | 236 | 0 => 'entity_table', |
c3fc2621 CW |
237 | ], |
238 | 'localizable' => FALSE, | |
e7a6b91a | 239 | 'sig' => 'civicrm_entity_financial_trxn::0::entity_table', |
c3fc2621 CW |
240 | ], |
241 | 'UI_entity_financial_trxn_entity_id' => [ | |
e7a6b91a | 242 | 'name' => 'UI_entity_financial_trxn_entity_id', |
c3fc2621 | 243 | 'field' => [ |
e7a6b91a | 244 | 0 => 'entity_id', |
c3fc2621 CW |
245 | ], |
246 | 'localizable' => FALSE, | |
e7a6b91a | 247 | 'sig' => 'civicrm_entity_financial_trxn::0::entity_id', |
c3fc2621 CW |
248 | ], |
249 | ]; | |
e7a6b91a AS |
250 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
251 | } | |
c3fc2621 | 252 | |
e501603b | 253 | } |