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:70f25c56047d21ecc405e8b7a60ef68d)
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_BAO_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_BAO_EntityFinancialAccount',
143 'pseudoconstant' => [
144 'callback' => 'CRM_Financial_BAO_EntityFinancialAccount::entityTables',
149 'name' => 'entity_id',
150 'type' => CRM_Utils_Type
::T_INT
,
151 'title' => ts('Entity ID'),
152 'description' => ts('Links to an id in the entity_table, such as vid in civicrm_financial_type'),
154 'where' => 'civicrm_entity_financial_account.entity_id',
155 'table_name' => 'civicrm_entity_financial_account',
156 'entity' => 'EntityFinancialAccount',
157 'bao' => 'CRM_Financial_BAO_EntityFinancialAccount',
161 'account_relationship' => [
162 'name' => 'account_relationship',
163 'type' => CRM_Utils_Type
::T_INT
,
164 'title' => ts('Account Relationship'),
165 'description' => ts('FK to a new civicrm_option_value (account_relationship)'),
167 'where' => 'civicrm_entity_financial_account.account_relationship',
168 'table_name' => 'civicrm_entity_financial_account',
169 'entity' => 'EntityFinancialAccount',
170 'bao' => 'CRM_Financial_BAO_EntityFinancialAccount',
175 'pseudoconstant' => [
176 'optionGroupName' => 'account_relationship',
177 'optionEditPath' => 'civicrm/admin/options/account_relationship',
181 'financial_account_id' => [
182 'name' => 'financial_account_id',
183 'type' => CRM_Utils_Type
::T_INT
,
184 'title' => ts('Financial Account ID'),
185 'description' => ts('FK to the financial_account_id'),
187 'where' => 'civicrm_entity_financial_account.financial_account_id',
188 'table_name' => 'civicrm_entity_financial_account',
189 'entity' => 'EntityFinancialAccount',
190 'bao' => 'CRM_Financial_BAO_EntityFinancialAccount',
192 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
195 'label' => ts("Financial Account"),
197 'pseudoconstant' => [
198 'table' => 'civicrm_financial_account',
200 'labelColumn' => 'name',
205 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
207 return Civi
::$statics[__CLASS__
]['fields'];
211 * Return a mapping from field-name to the corresponding key (as used in fields()).
214 * Array(string $name => string $uniqueName).
216 public static function &fieldKeys() {
217 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
218 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
220 return Civi
::$statics[__CLASS__
]['fieldKeys'];
224 * Returns the names of this table
228 public static function getTableName() {
229 return self
::$_tableName;
233 * Returns if this table needs to be logged
237 public function getLog() {
242 * Returns the list of fields that can be imported
244 * @param bool $prefix
248 public static function &import($prefix = FALSE) {
249 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'entity_financial_account', $prefix, []);
254 * Returns the list of fields that can be exported
256 * @param bool $prefix
260 public static function &export($prefix = FALSE) {
261 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'entity_financial_account', $prefix, []);
266 * Returns the list of indices
268 * @param bool $localize
272 public static function indices($localize = TRUE) {
274 'index_entity_id_entity_table_account_relationship' => [
275 'name' => 'index_entity_id_entity_table_account_relationship',
279 2 => 'account_relationship',
281 'localizable' => FALSE,
283 'sig' => 'civicrm_entity_financial_account::1::entity_id::entity_table::account_relationship',
286 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;