5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Financial/EntityFinancialAccount.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:caf02136c148fe50dbc39d8d29605f72)
13 * Database access object for the EntityFinancialAccount entity.
15 class CRM_Financial_DAO_EntityFinancialAccount
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '4.3';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_entity_financial_account';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
42 * Links to an entity_table like civicrm_financial_type
49 * Links to an id in the entity_table, such as vid in civicrm_financial_type
56 * FK to a new civicrm_option_value (account_relationship)
60 public $account_relationship;
63 * FK to the financial_account_id
67 public $financial_account_id;
72 public function __construct() {
73 $this->__table
= 'civicrm_entity_financial_account';
74 parent
::__construct();
78 * Returns localized title of this entity.
81 * Whether to return the plural version of the title.
83 public static function getEntityTitle($plural = FALSE) {
84 return $plural ?
ts('Entity Financial Accounts') : ts('Entity Financial Account');
88 * Returns foreign keys and entity references.
91 * [CRM_Core_Reference_Interface]
93 public static function getReferenceColumns() {
94 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
95 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
96 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_account_id', 'civicrm_financial_account', 'id');
97 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
98 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
100 return Civi
::$statics[__CLASS__
]['links'];
104 * Returns all the column names of this table
108 public static function &fields() {
109 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
110 Civi
::$statics[__CLASS__
]['fields'] = [
113 'type' => CRM_Utils_Type
::T_INT
,
114 'title' => ts('Entity Financial Account ID'),
115 'description' => ts('ID'),
117 'where' => 'civicrm_entity_financial_account.id',
118 'table_name' => 'civicrm_entity_financial_account',
119 'entity' => 'EntityFinancialAccount',
120 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
129 'name' => 'entity_table',
130 'type' => CRM_Utils_Type
::T_STRING
,
131 'title' => ts('Entity Table'),
132 'description' => ts('Links to an entity_table like civicrm_financial_type'),
135 'size' => CRM_Utils_Type
::BIG
,
137 'where' => 'civicrm_entity_financial_account.entity_table',
139 'table_name' => 'civicrm_entity_financial_account',
140 'entity' => 'EntityFinancialAccount',
141 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
146 'name' => 'entity_id',
147 'type' => CRM_Utils_Type
::T_INT
,
148 'title' => ts('Entity ID'),
149 'description' => ts('Links to an id in the entity_table, such as vid in civicrm_financial_type'),
151 'where' => 'civicrm_entity_financial_account.entity_id',
152 'table_name' => 'civicrm_entity_financial_account',
153 'entity' => 'EntityFinancialAccount',
154 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
158 'account_relationship' => [
159 'name' => 'account_relationship',
160 'type' => CRM_Utils_Type
::T_INT
,
161 'title' => ts('Account Relationship'),
162 'description' => ts('FK to a new civicrm_option_value (account_relationship)'),
164 'where' => 'civicrm_entity_financial_account.account_relationship',
165 'table_name' => 'civicrm_entity_financial_account',
166 'entity' => 'EntityFinancialAccount',
167 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
172 'pseudoconstant' => [
173 'optionGroupName' => 'account_relationship',
174 'optionEditPath' => 'civicrm/admin/options/account_relationship',
178 'financial_account_id' => [
179 'name' => 'financial_account_id',
180 'type' => CRM_Utils_Type
::T_INT
,
181 'title' => ts('Financial Account ID'),
182 'description' => ts('FK to the financial_account_id'),
184 'where' => 'civicrm_entity_financial_account.financial_account_id',
185 'table_name' => 'civicrm_entity_financial_account',
186 'entity' => 'EntityFinancialAccount',
187 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
189 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
192 'label' => ts("Financial Account"),
194 'pseudoconstant' => [
195 'table' => 'civicrm_financial_account',
197 'labelColumn' => 'name',
202 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
204 return Civi
::$statics[__CLASS__
]['fields'];
208 * Return a mapping from field-name to the corresponding key (as used in fields()).
211 * Array(string $name => string $uniqueName).
213 public static function &fieldKeys() {
214 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
215 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
217 return Civi
::$statics[__CLASS__
]['fieldKeys'];
221 * Returns the names of this table
225 public static function getTableName() {
226 return self
::$_tableName;
230 * Returns if this table needs to be logged
234 public function getLog() {
239 * Returns the list of fields that can be imported
241 * @param bool $prefix
245 public static function &import($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'entity_financial_account', $prefix, []);
251 * Returns the list of fields that can be exported
253 * @param bool $prefix
257 public static function &export($prefix = FALSE) {
258 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'entity_financial_account', $prefix, []);
263 * Returns the list of indices
265 * @param bool $localize
269 public static function indices($localize = TRUE) {
271 'index_entity_id_entity_table_account_relationship' => [
272 'name' => 'index_entity_id_entity_table_account_relationship',
276 2 => 'account_relationship',
278 'localizable' => FALSE,
280 'sig' => 'civicrm_entity_financial_account::1::entity_id::entity_table::account_relationship',
283 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;