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:04adc48b1cca1ec60c364ec136ddc148)
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;
37 * @var int|string|null
38 * (SQL type: int unsigned)
39 * Note that values will be retrieved from the database as a string.
44 * May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc
47 * (SQL type: varchar(64))
48 * Note that values will be retrieved from the database as a string.
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
60 * @var int|string|null
61 * (SQL type: int unsigned)
62 * Note that values will be retrieved from the database as a string.
64 public $financial_trxn_id;
67 * allocated amount of transaction to this entity
70 * (SQL type: decimal(20,2))
71 * Note that values will be retrieved from the database as a string.
78 public function __construct() {
79 $this->__table
= 'civicrm_entity_financial_trxn';
80 parent
::__construct();
84 * Returns localized title of this entity.
87 * Whether to return the plural version of the title.
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ?
ts('Entity Financial Trxns') : ts('Entity Financial Trxn');
94 * Returns foreign keys and entity references.
97 * [CRM_Core_Reference_Interface]
99 public static function getReferenceColumns() {
100 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
101 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
102 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_trxn_id', 'civicrm_financial_trxn', 'id');
103 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
104 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
106 return Civi
::$statics[__CLASS__
]['links'];
110 * Returns all the column names of this table
114 public static function &fields() {
115 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
116 Civi
::$statics[__CLASS__
]['fields'] = [
119 'type' => CRM_Utils_Type
::T_INT
,
120 'title' => ts('Entity Financial Transaction ID'),
121 'description' => ts('ID'),
123 'where' => 'civicrm_entity_financial_trxn.id',
124 'table_name' => 'civicrm_entity_financial_trxn',
125 'entity' => 'EntityFinancialTrxn',
126 'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
135 'name' => 'entity_table',
136 'type' => CRM_Utils_Type
::T_STRING
,
137 'title' => ts('Entity Table'),
138 'description' => ts('May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc'),
141 'size' => CRM_Utils_Type
::BIG
,
143 'where' => 'civicrm_entity_financial_trxn.entity_table',
145 'table_name' => 'civicrm_entity_financial_trxn',
146 'entity' => 'EntityFinancialTrxn',
147 'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
149 'pseudoconstant' => [
150 'callback' => 'CRM_Financial_BAO_EntityFinancialTrxn::entityTables',
155 'name' => 'entity_id',
156 'type' => CRM_Utils_Type
::T_INT
,
157 'title' => ts('Entity ID'),
159 'where' => 'civicrm_entity_financial_trxn.entity_id',
160 'table_name' => 'civicrm_entity_financial_trxn',
161 'entity' => 'EntityFinancialTrxn',
162 'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
166 'financial_trxn_id' => [
167 'name' => 'financial_trxn_id',
168 'type' => CRM_Utils_Type
::T_INT
,
169 'title' => ts('Financial Transaction ID'),
170 'where' => 'civicrm_entity_financial_trxn.financial_trxn_id',
171 'table_name' => 'civicrm_entity_financial_trxn',
172 'entity' => 'EntityFinancialTrxn',
173 'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
175 'FKClassName' => 'CRM_Financial_DAO_FinancialTrxn',
177 'label' => ts("Financial Transaction"),
183 'type' => CRM_Utils_Type
::T_MONEY
,
184 'title' => ts('Amount'),
185 'description' => ts('allocated amount of transaction to this entity'),
192 'where' => 'civicrm_entity_financial_trxn.amount',
193 'headerPattern' => '/amount/i',
194 'dataPattern' => '/^\d+(\.\d{2})?$/',
196 'table_name' => 'civicrm_entity_financial_trxn',
197 'entity' => 'EntityFinancialTrxn',
198 'bao' => 'CRM_Financial_BAO_EntityFinancialTrxn',
203 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
205 return Civi
::$statics[__CLASS__
]['fields'];
209 * Return a mapping from field-name to the corresponding key (as used in fields()).
212 * Array(string $name => string $uniqueName).
214 public static function &fieldKeys() {
215 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
216 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
218 return Civi
::$statics[__CLASS__
]['fieldKeys'];
222 * Returns the names of this table
226 public static function getTableName() {
227 return self
::$_tableName;
231 * Returns if this table needs to be logged
235 public function getLog() {
240 * Returns the list of fields that can be imported
242 * @param bool $prefix
246 public static function &import($prefix = FALSE) {
247 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'entity_financial_trxn', $prefix, []);
252 * Returns the list of fields that can be exported
254 * @param bool $prefix
258 public static function &export($prefix = FALSE) {
259 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'entity_financial_trxn', $prefix, []);
264 * Returns the list of indices
266 * @param bool $localize
270 public static function indices($localize = TRUE) {
272 'UI_entity_financial_trxn_entity_table' => [
273 'name' => 'UI_entity_financial_trxn_entity_table',
277 'localizable' => FALSE,
278 'sig' => 'civicrm_entity_financial_trxn::0::entity_table',
280 'UI_entity_financial_trxn_entity_id' => [
281 'name' => 'UI_entity_financial_trxn_entity_id',
285 'localizable' => FALSE,
286 'sig' => 'civicrm_entity_financial_trxn::0::entity_id',
289 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;