Regenerate DAO files to have 'where' fields defined
[civicrm-core.git] / CRM / Financial / DAO / EntityFinancialTrxn.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Financial/EntityFinancialTrxn.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e380ee3b 9 * (GenCodeChecksum:b7687297d632a4658b6686a5b540f974)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the EntityFinancialTrxn entity.
f41f0342 14 */
e501603b 15class 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 */
fa45b5b9 22 public 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 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 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 77 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 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,
a36434b9 100 'where' => 'civicrm_entity_financial_trxn.id',
522a26c9 101 'table_name' => 'civicrm_entity_financial_trxn',
102 'entity' => 'EntityFinancialTrxn',
103 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
6a7e5e5d 104 'localizable' => 0,
c3fc2621
CW
105 ],
106 'entity_table' => [
e501603b
TO
107 'name' => 'entity_table',
108 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 109 'title' => ts('Entity Table'),
215b423e 110 'description' => ts('May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc'),
c3fc2621 111 'required' => TRUE,
e501603b
TO
112 'maxlength' => 64,
113 'size' => CRM_Utils_Type::BIG,
c3fc2621 114 'import' => TRUE,
e501603b 115 'where' => 'civicrm_entity_financial_trxn.entity_table',
c3fc2621 116 'export' => TRUE,
522a26c9 117 'table_name' => 'civicrm_entity_financial_trxn',
118 'entity' => 'EntityFinancialTrxn',
119 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
6a7e5e5d 120 'localizable' => 0,
c3fc2621
CW
121 ],
122 'entity_id' => [
e501603b
TO
123 'name' => 'entity_id',
124 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
125 'title' => ts('Entity ID'),
126 'required' => TRUE,
a36434b9 127 'where' => 'civicrm_entity_financial_trxn.entity_id',
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'),
a36434b9 137 'where' => 'civicrm_entity_financial_trxn.financial_trxn_id',
522a26c9 138 'table_name' => 'civicrm_entity_financial_trxn',
139 'entity' => 'EntityFinancialTrxn',
140 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
6a7e5e5d 141 'localizable' => 0,
e501603b 142 'FKClassName' => 'CRM_Financial_DAO_FinancialTrxn',
c3fc2621
CW
143 ],
144 'amount' => [
e501603b
TO
145 'name' => 'amount',
146 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 147 'title' => ts('Amount'),
215b423e 148 'description' => ts('allocated amount of transaction to this entity'),
c3fc2621
CW
149 'required' => TRUE,
150 'precision' => [
e501603b
TO
151 20,
152 2
c3fc2621
CW
153 ],
154 'import' => TRUE,
e501603b
TO
155 'where' => 'civicrm_entity_financial_trxn.amount',
156 'headerPattern' => '/amount/i',
157 'dataPattern' => '/^\d+(\.\d{2})?$/',
c3fc2621 158 'export' => TRUE,
522a26c9 159 'table_name' => 'civicrm_entity_financial_trxn',
160 'entity' => 'EntityFinancialTrxn',
161 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn',
6a7e5e5d 162 'localizable' => 0,
c3fc2621
CW
163 ],
164 ];
346aaaba 165 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 166 }
346aaaba 167 return Civi::$statics[__CLASS__]['fields'];
e501603b 168 }
c3fc2621 169
e501603b 170 /**
bd8e0b14 171 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
172 *
173 * @return array
bd8e0b14 174 * Array(string $name => string $uniqueName).
e501603b 175 */
c3fc2621 176 public static function &fieldKeys() {
bd8e0b14
TO
177 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
178 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 179 }
bd8e0b14 180 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 181 }
c3fc2621 182
e501603b
TO
183 /**
184 * Returns the names of this table
185 *
186 * @return string
187 */
c3fc2621 188 public static function getTableName() {
e501603b
TO
189 return self::$_tableName;
190 }
c3fc2621 191
e501603b
TO
192 /**
193 * Returns if this table needs to be logged
194 *
c3fc2621 195 * @return bool
e501603b 196 */
c3fc2621 197 public function getLog() {
e501603b
TO
198 return self::$_log;
199 }
c3fc2621 200
e501603b
TO
201 /**
202 * Returns the list of fields that can be imported
203 *
204 * @param bool $prefix
205 *
206 * @return array
207 */
c3fc2621
CW
208 public static function &import($prefix = FALSE) {
209 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_trxn', $prefix, []);
60808919 210 return $r;
e501603b 211 }
c3fc2621 212
e501603b
TO
213 /**
214 * Returns the list of fields that can be exported
215 *
216 * @param bool $prefix
217 *
218 * @return array
219 */
c3fc2621
CW
220 public static function &export($prefix = FALSE) {
221 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_trxn', $prefix, []);
60808919 222 return $r;
e501603b 223 }
c3fc2621 224
e7a6b91a
AS
225 /**
226 * Returns the list of indices
c3fc2621
CW
227 *
228 * @param bool $localize
229 *
230 * @return array
e7a6b91a
AS
231 */
232 public static function indices($localize = TRUE) {
c3fc2621
CW
233 $indices = [
234 'UI_entity_financial_trxn_entity_table' => [
e7a6b91a 235 'name' => 'UI_entity_financial_trxn_entity_table',
c3fc2621 236 'field' => [
e7a6b91a 237 0 => 'entity_table',
c3fc2621
CW
238 ],
239 'localizable' => FALSE,
e7a6b91a 240 'sig' => 'civicrm_entity_financial_trxn::0::entity_table',
c3fc2621
CW
241 ],
242 'UI_entity_financial_trxn_entity_id' => [
e7a6b91a 243 'name' => 'UI_entity_financial_trxn_entity_id',
c3fc2621 244 'field' => [
e7a6b91a 245 0 => 'entity_id',
c3fc2621
CW
246 ],
247 'localizable' => FALSE,
e7a6b91a 248 'sig' => 'civicrm_entity_financial_trxn::0::entity_id',
c3fc2621
CW
249 ],
250 ];
e7a6b91a
AS
251 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
252 }
c3fc2621 253
e501603b 254}