Merge pull request #15944 from magnolia61/Sort_CMS_tables_alphabetically
[civicrm-core.git] / CRM / Financial / DAO / EntityFinancialAccount.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Financial/EntityFinancialAccount.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
74db51d3 9 * (GenCodeChecksum:9d665341d7a4293411adf33acafdae1d)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the EntityFinancialAccount entity.
f41f0342 14 */
e501603b 15class CRM_Financial_DAO_EntityFinancialAccount extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_entity_financial_account';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = TRUE;
c3fc2621 30
e501603b
TO
31 /**
32 * ID
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Links to an entity_table like civicrm_financial_type
40 *
41 * @var string
42 */
43 public $entity_table;
c3fc2621 44
e501603b
TO
45 /**
46 * Links to an id in the entity_table, such as vid in civicrm_financial_type
47 *
e6ca0a57 48 * @var int
e501603b
TO
49 */
50 public $entity_id;
c3fc2621 51
e501603b
TO
52 /**
53 * FK to a new civicrm_option_value (account_relationship)
54 *
e6ca0a57 55 * @var int
e501603b
TO
56 */
57 public $account_relationship;
c3fc2621 58
e501603b
TO
59 /**
60 * FK to the financial_account_id
61 *
e6ca0a57 62 * @var int
e501603b
TO
63 */
64 public $financial_account_id;
c3fc2621 65
e501603b 66 /**
f41f0342 67 * Class constructor.
e501603b 68 */
c3fc2621 69 public function __construct() {
e501603b
TO
70 $this->__table = 'civicrm_entity_financial_account';
71 parent::__construct();
72 }
c3fc2621 73
e501603b 74 /**
f41f0342 75 * Returns foreign keys and entity references.
e501603b
TO
76 *
77 * @return array
78 * [CRM_Core_Reference_Interface]
79 */
c3fc2621 80 public static function getReferenceColumns() {
346aaaba 81 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 82 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
83 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_account_id', 'civicrm_financial_account', 'id');
84 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 85 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 86 }
346aaaba 87 return Civi::$statics[__CLASS__]['links'];
e501603b 88 }
c3fc2621 89
e501603b
TO
90 /**
91 * Returns all the column names of this table
92 *
93 * @return array
94 */
c3fc2621 95 public static function &fields() {
346aaaba 96 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
97 Civi::$statics[__CLASS__]['fields'] = [
98 'id' => [
e501603b
TO
99 'name' => 'id',
100 'type' => CRM_Utils_Type::T_INT,
c3fc2621 101 'title' => ts('Entity Financial Account ID'),
215b423e 102 'description' => ts('ID'),
c3fc2621 103 'required' => TRUE,
a36434b9 104 'where' => 'civicrm_entity_financial_account.id',
522a26c9 105 'table_name' => 'civicrm_entity_financial_account',
106 'entity' => 'EntityFinancialAccount',
107 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 108 'localizable' => 0,
c3fc2621
CW
109 ],
110 'entity_table' => [
e501603b
TO
111 'name' => 'entity_table',
112 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 113 'title' => ts('Entity Table'),
215b423e 114 'description' => ts('Links to an entity_table like civicrm_financial_type'),
c3fc2621 115 'required' => TRUE,
e501603b
TO
116 'maxlength' => 64,
117 'size' => CRM_Utils_Type::BIG,
c3fc2621 118 'import' => TRUE,
e501603b 119 'where' => 'civicrm_entity_financial_account.entity_table',
c3fc2621 120 'export' => TRUE,
522a26c9 121 'table_name' => 'civicrm_entity_financial_account',
122 'entity' => 'EntityFinancialAccount',
123 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 124 'localizable' => 0,
c3fc2621
CW
125 ],
126 'entity_id' => [
e501603b
TO
127 'name' => 'entity_id',
128 'type' => CRM_Utils_Type::T_INT,
c3fc2621 129 'title' => ts('Entity ID'),
215b423e 130 'description' => ts('Links to an id in the entity_table, such as vid in civicrm_financial_type'),
c3fc2621 131 'required' => TRUE,
a36434b9 132 'where' => 'civicrm_entity_financial_account.entity_id',
522a26c9 133 'table_name' => 'civicrm_entity_financial_account',
134 'entity' => 'EntityFinancialAccount',
135 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 136 'localizable' => 0,
c3fc2621
CW
137 ],
138 'account_relationship' => [
e501603b
TO
139 'name' => 'account_relationship',
140 'type' => CRM_Utils_Type::T_INT,
c3fc2621 141 'title' => ts('Account Relationship'),
215b423e 142 'description' => ts('FK to a new civicrm_option_value (account_relationship)'),
c3fc2621 143 'required' => TRUE,
a36434b9 144 'where' => 'civicrm_entity_financial_account.account_relationship',
522a26c9 145 'table_name' => 'civicrm_entity_financial_account',
146 'entity' => 'EntityFinancialAccount',
147 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 148 'localizable' => 0,
c3fc2621 149 'html' => [
e501603b 150 'type' => 'Select',
c3fc2621
CW
151 ],
152 'pseudoconstant' => [
e501603b
TO
153 'optionGroupName' => 'account_relationship',
154 'optionEditPath' => 'civicrm/admin/options/account_relationship',
e6ca0a57 155 ],
c3fc2621
CW
156 ],
157 'financial_account_id' => [
e501603b
TO
158 'name' => 'financial_account_id',
159 'type' => CRM_Utils_Type::T_INT,
c3fc2621 160 'title' => ts('Financial Account'),
215b423e 161 'description' => ts('FK to the financial_account_id'),
c3fc2621 162 'required' => TRUE,
a36434b9 163 'where' => 'civicrm_entity_financial_account.financial_account_id',
522a26c9 164 'table_name' => 'civicrm_entity_financial_account',
165 'entity' => 'EntityFinancialAccount',
166 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 167 'localizable' => 0,
e501603b 168 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
c3fc2621 169 'html' => [
e501603b 170 'type' => 'Select',
c3fc2621
CW
171 ],
172 'pseudoconstant' => [
e501603b
TO
173 'table' => 'civicrm_financial_account',
174 'keyColumn' => 'id',
175 'labelColumn' => 'name',
e6ca0a57 176 ],
c3fc2621
CW
177 ],
178 ];
346aaaba 179 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 180 }
346aaaba 181 return Civi::$statics[__CLASS__]['fields'];
e501603b 182 }
c3fc2621 183
e501603b 184 /**
bd8e0b14 185 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
186 *
187 * @return array
bd8e0b14 188 * Array(string $name => string $uniqueName).
e501603b 189 */
c3fc2621 190 public static function &fieldKeys() {
bd8e0b14
TO
191 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
192 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 193 }
bd8e0b14 194 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 195 }
c3fc2621 196
e501603b
TO
197 /**
198 * Returns the names of this table
199 *
200 * @return string
201 */
c3fc2621 202 public static function getTableName() {
e501603b
TO
203 return self::$_tableName;
204 }
c3fc2621 205
e501603b
TO
206 /**
207 * Returns if this table needs to be logged
208 *
c3fc2621 209 * @return bool
e501603b 210 */
c3fc2621 211 public function getLog() {
e501603b
TO
212 return self::$_log;
213 }
c3fc2621 214
e501603b
TO
215 /**
216 * Returns the list of fields that can be imported
217 *
218 * @param bool $prefix
219 *
220 * @return array
221 */
c3fc2621
CW
222 public static function &import($prefix = FALSE) {
223 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_account', $prefix, []);
60808919 224 return $r;
e501603b 225 }
c3fc2621 226
e501603b
TO
227 /**
228 * Returns the list of fields that can be exported
229 *
230 * @param bool $prefix
231 *
232 * @return array
233 */
c3fc2621
CW
234 public static function &export($prefix = FALSE) {
235 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_account', $prefix, []);
60808919 236 return $r;
e501603b 237 }
c3fc2621 238
e7a6b91a
AS
239 /**
240 * Returns the list of indices
c3fc2621
CW
241 *
242 * @param bool $localize
243 *
244 * @return array
e7a6b91a
AS
245 */
246 public static function indices($localize = TRUE) {
c3fc2621
CW
247 $indices = [
248 'index_entity_id_entity_table_account_relationship' => [
5b3543ce 249 'name' => 'index_entity_id_entity_table_account_relationship',
c3fc2621 250 'field' => [
5b3543ce
JM
251 0 => 'entity_id',
252 1 => 'entity_table',
253 2 => 'account_relationship',
c3fc2621
CW
254 ],
255 'localizable' => FALSE,
256 'unique' => TRUE,
5b3543ce 257 'sig' => 'civicrm_entity_financial_account::1::entity_id::entity_table::account_relationship',
c3fc2621
CW
258 ],
259 ];
e7a6b91a
AS
260 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
261 }
c3fc2621 262
e501603b 263}