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:e7fe0d109914d345588895ccf1838406)
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',
125 'name' => 'entity_table',
126 'type' => CRM_Utils_Type
::T_STRING
,
127 'title' => ts('Entity Table'),
128 'description' => ts('Links to an entity_table like civicrm_financial_type'),
131 'size' => CRM_Utils_Type
::BIG
,
133 'where' => 'civicrm_entity_financial_account.entity_table',
135 'table_name' => 'civicrm_entity_financial_account',
136 'entity' => 'EntityFinancialAccount',
137 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
142 'name' => 'entity_id',
143 'type' => CRM_Utils_Type
::T_INT
,
144 'title' => ts('Entity ID'),
145 'description' => ts('Links to an id in the entity_table, such as vid in civicrm_financial_type'),
147 'where' => 'civicrm_entity_financial_account.entity_id',
148 'table_name' => 'civicrm_entity_financial_account',
149 'entity' => 'EntityFinancialAccount',
150 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
154 'account_relationship' => [
155 'name' => 'account_relationship',
156 'type' => CRM_Utils_Type
::T_INT
,
157 'title' => ts('Account Relationship'),
158 'description' => ts('FK to a new civicrm_option_value (account_relationship)'),
160 'where' => 'civicrm_entity_financial_account.account_relationship',
161 'table_name' => 'civicrm_entity_financial_account',
162 'entity' => 'EntityFinancialAccount',
163 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
168 'pseudoconstant' => [
169 'optionGroupName' => 'account_relationship',
170 'optionEditPath' => 'civicrm/admin/options/account_relationship',
174 'financial_account_id' => [
175 'name' => 'financial_account_id',
176 'type' => CRM_Utils_Type
::T_INT
,
177 'title' => ts('Financial Account'),
178 'description' => ts('FK to the financial_account_id'),
180 'where' => 'civicrm_entity_financial_account.financial_account_id',
181 'table_name' => 'civicrm_entity_financial_account',
182 'entity' => 'EntityFinancialAccount',
183 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
185 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
189 'pseudoconstant' => [
190 'table' => 'civicrm_financial_account',
192 'labelColumn' => 'name',
197 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
199 return Civi
::$statics[__CLASS__
]['fields'];
203 * Return a mapping from field-name to the corresponding key (as used in fields()).
206 * Array(string $name => string $uniqueName).
208 public static function &fieldKeys() {
209 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
210 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
212 return Civi
::$statics[__CLASS__
]['fieldKeys'];
216 * Returns the names of this table
220 public static function getTableName() {
221 return self
::$_tableName;
225 * Returns if this table needs to be logged
229 public function getLog() {
234 * Returns the list of fields that can be imported
236 * @param bool $prefix
240 public static function &import($prefix = FALSE) {
241 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'entity_financial_account', $prefix, []);
246 * Returns the list of fields that can be exported
248 * @param bool $prefix
252 public static function &export($prefix = FALSE) {
253 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'entity_financial_account', $prefix, []);
258 * Returns the list of indices
260 * @param bool $localize
264 public static function indices($localize = TRUE) {
266 'index_entity_id_entity_table_account_relationship' => [
267 'name' => 'index_entity_id_entity_table_account_relationship',
271 2 => 'account_relationship',
273 'localizable' => FALSE,
275 'sig' => 'civicrm_entity_financial_account::1::entity_id::entity_table::account_relationship',
278 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;