5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Financial/EntityFinancialTrxn.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:fafa322736bff4ccf082449b5e54cd35)
13 * Database access object for the EntityFinancialTrxn entity.
15 class CRM_Financial_DAO_EntityFinancialTrxn
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '3.2';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_entity_financial_trxn';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
42 * May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc
56 public $financial_trxn_id;
59 * allocated amount of transaction to this entity
68 public function __construct() {
69 $this->__table
= 'civicrm_entity_financial_trxn';
70 parent
::__construct();
74 * Returns localized title of this entity.
77 * Whether to return the plural version of the title.
79 public static function getEntityTitle($plural = FALSE) {
80 return $plural ?
ts('Entity Financial Trxns') : ts('Entity Financial Trxn');
84 * Returns foreign keys and entity references.
87 * [CRM_Core_Reference_Interface]
89 public static function getReferenceColumns() {
90 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
91 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
92 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_trxn_id', 'civicrm_financial_trxn', 'id');
93 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
94 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
96 return Civi
::$statics[__CLASS__
]['links'];
100 * Returns all the column names of this table
104 public static function &fields() {
105 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
106 Civi
::$statics[__CLASS__
]['fields'] = [
109 'type' => CRM_Utils_Type
::T_INT
,
110 'title' => ts('Entity Financial Transaction ID'),
111 'description' => ts('ID'),
113 'where' => 'civicrm_entity_financial_trxn.id',
114 'table_name' => 'civicrm_entity_financial_trxn',
115 'entity' => 'EntityFinancialTrxn',
116 'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
125 'name' => 'entity_table',
126 'type' => CRM_Utils_Type
::T_STRING
,
127 'title' => ts('Entity Table'),
128 'description' => ts('May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc'),
131 'size' => CRM_Utils_Type
::BIG
,
133 'where' => 'civicrm_entity_financial_trxn.entity_table',
135 'table_name' => 'civicrm_entity_financial_trxn',
136 'entity' => 'EntityFinancialTrxn',
137 'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
139 'pseudoconstant' => [
140 'callback' => 'CRM_Financial_BAO_EntityFinancialTrxn::entityTables',
145 'name' => 'entity_id',
146 'type' => CRM_Utils_Type
::T_INT
,
147 'title' => ts('Entity ID'),
149 'where' => 'civicrm_entity_financial_trxn.entity_id',
150 'table_name' => 'civicrm_entity_financial_trxn',
151 'entity' => 'EntityFinancialTrxn',
152 'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
156 'financial_trxn_id' => [
157 'name' => 'financial_trxn_id',
158 'type' => CRM_Utils_Type
::T_INT
,
159 'title' => ts('Financial Transaction ID'),
160 'where' => 'civicrm_entity_financial_trxn.financial_trxn_id',
161 'table_name' => 'civicrm_entity_financial_trxn',
162 'entity' => 'EntityFinancialTrxn',
163 'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
165 'FKClassName' => 'CRM_Financial_DAO_FinancialTrxn',
167 'label' => ts("Financial Transaction"),
173 'type' => CRM_Utils_Type
::T_MONEY
,
174 'title' => ts('Amount'),
175 'description' => ts('allocated amount of transaction to this entity'),
182 'where' => 'civicrm_entity_financial_trxn.amount',
183 'headerPattern' => '/amount/i',
184 'dataPattern' => '/^\d+(\.\d{2})?$/',
186 'table_name' => 'civicrm_entity_financial_trxn',
187 'entity' => 'EntityFinancialTrxn',
188 'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
193 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
195 return Civi
::$statics[__CLASS__
]['fields'];
199 * Return a mapping from field-name to the corresponding key (as used in fields()).
202 * Array(string $name => string $uniqueName).
204 public static function &fieldKeys() {
205 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
206 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
208 return Civi
::$statics[__CLASS__
]['fieldKeys'];
212 * Returns the names of this table
216 public static function getTableName() {
217 return self
::$_tableName;
221 * Returns if this table needs to be logged
225 public function getLog() {
230 * Returns the list of fields that can be imported
232 * @param bool $prefix
236 public static function &import($prefix = FALSE) {
237 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'entity_financial_trxn', $prefix, []);
242 * Returns the list of fields that can be exported
244 * @param bool $prefix
248 public static function &export($prefix = FALSE) {
249 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'entity_financial_trxn', $prefix, []);
254 * Returns the list of indices
256 * @param bool $localize
260 public static function indices($localize = TRUE) {
262 'UI_entity_financial_trxn_entity_table' => [
263 'name' => 'UI_entity_financial_trxn_entity_table',
267 'localizable' => FALSE,
268 'sig' => 'civicrm_entity_financial_trxn::0::entity_table',
270 'UI_entity_financial_trxn_entity_id' => [
271 'name' => 'UI_entity_financial_trxn_entity_id',
275 'localizable' => FALSE,
276 'sig' => 'civicrm_entity_financial_trxn::0::entity_id',
279 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;