API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[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
a9d0587b 9 * (GenCodeChecksum:5ed0eeb7d3f5f2caf668448cd441b004)
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
449c4e6b
CW
74 /**
75 * Returns localized title of this entity.
76 */
77 public static function getEntityTitle() {
78 return ts('Entity Financial Accounts');
79 }
80
e501603b 81 /**
f41f0342 82 * Returns foreign keys and entity references.
e501603b
TO
83 *
84 * @return array
85 * [CRM_Core_Reference_Interface]
86 */
c3fc2621 87 public static function getReferenceColumns() {
346aaaba 88 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 89 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
90 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_account_id', 'civicrm_financial_account', 'id');
91 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 92 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 93 }
346aaaba 94 return Civi::$statics[__CLASS__]['links'];
e501603b 95 }
c3fc2621 96
e501603b
TO
97 /**
98 * Returns all the column names of this table
99 *
100 * @return array
101 */
c3fc2621 102 public static function &fields() {
346aaaba 103 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
104 Civi::$statics[__CLASS__]['fields'] = [
105 'id' => [
e501603b
TO
106 'name' => 'id',
107 'type' => CRM_Utils_Type::T_INT,
c3fc2621 108 'title' => ts('Entity Financial Account ID'),
215b423e 109 'description' => ts('ID'),
c3fc2621 110 'required' => TRUE,
a36434b9 111 'where' => 'civicrm_entity_financial_account.id',
522a26c9 112 'table_name' => 'civicrm_entity_financial_account',
113 'entity' => 'EntityFinancialAccount',
114 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 115 'localizable' => 0,
a9d0587b 116 'add' => '4.3',
c3fc2621
CW
117 ],
118 'entity_table' => [
e501603b
TO
119 'name' => 'entity_table',
120 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 121 'title' => ts('Entity Table'),
215b423e 122 'description' => ts('Links to an entity_table like civicrm_financial_type'),
c3fc2621 123 'required' => TRUE,
e501603b
TO
124 'maxlength' => 64,
125 'size' => CRM_Utils_Type::BIG,
c3fc2621 126 'import' => TRUE,
e501603b 127 'where' => 'civicrm_entity_financial_account.entity_table',
c3fc2621 128 'export' => TRUE,
522a26c9 129 'table_name' => 'civicrm_entity_financial_account',
130 'entity' => 'EntityFinancialAccount',
131 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 132 'localizable' => 0,
a9d0587b 133 'add' => '4.3',
c3fc2621
CW
134 ],
135 'entity_id' => [
e501603b
TO
136 'name' => 'entity_id',
137 'type' => CRM_Utils_Type::T_INT,
c3fc2621 138 'title' => ts('Entity ID'),
215b423e 139 'description' => ts('Links to an id in the entity_table, such as vid in civicrm_financial_type'),
c3fc2621 140 'required' => TRUE,
a36434b9 141 'where' => 'civicrm_entity_financial_account.entity_id',
522a26c9 142 'table_name' => 'civicrm_entity_financial_account',
143 'entity' => 'EntityFinancialAccount',
144 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 145 'localizable' => 0,
a9d0587b 146 'add' => '4.3',
c3fc2621
CW
147 ],
148 'account_relationship' => [
e501603b
TO
149 'name' => 'account_relationship',
150 'type' => CRM_Utils_Type::T_INT,
c3fc2621 151 'title' => ts('Account Relationship'),
215b423e 152 'description' => ts('FK to a new civicrm_option_value (account_relationship)'),
c3fc2621 153 'required' => TRUE,
a36434b9 154 'where' => 'civicrm_entity_financial_account.account_relationship',
522a26c9 155 'table_name' => 'civicrm_entity_financial_account',
156 'entity' => 'EntityFinancialAccount',
157 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 158 'localizable' => 0,
c3fc2621 159 'html' => [
e501603b 160 'type' => 'Select',
c3fc2621
CW
161 ],
162 'pseudoconstant' => [
e501603b
TO
163 'optionGroupName' => 'account_relationship',
164 'optionEditPath' => 'civicrm/admin/options/account_relationship',
e6ca0a57 165 ],
a9d0587b 166 'add' => '4.3',
c3fc2621
CW
167 ],
168 'financial_account_id' => [
e501603b
TO
169 'name' => 'financial_account_id',
170 'type' => CRM_Utils_Type::T_INT,
c3fc2621 171 'title' => ts('Financial Account'),
215b423e 172 'description' => ts('FK to the financial_account_id'),
c3fc2621 173 'required' => TRUE,
a36434b9 174 'where' => 'civicrm_entity_financial_account.financial_account_id',
522a26c9 175 'table_name' => 'civicrm_entity_financial_account',
176 'entity' => 'EntityFinancialAccount',
177 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 178 'localizable' => 0,
e501603b 179 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
c3fc2621 180 'html' => [
e501603b 181 'type' => 'Select',
c3fc2621
CW
182 ],
183 'pseudoconstant' => [
e501603b
TO
184 'table' => 'civicrm_financial_account',
185 'keyColumn' => 'id',
186 'labelColumn' => 'name',
e6ca0a57 187 ],
a9d0587b 188 'add' => '4.3',
c3fc2621
CW
189 ],
190 ];
346aaaba 191 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 192 }
346aaaba 193 return Civi::$statics[__CLASS__]['fields'];
e501603b 194 }
c3fc2621 195
e501603b 196 /**
bd8e0b14 197 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
198 *
199 * @return array
bd8e0b14 200 * Array(string $name => string $uniqueName).
e501603b 201 */
c3fc2621 202 public static function &fieldKeys() {
bd8e0b14
TO
203 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
204 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 205 }
bd8e0b14 206 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 207 }
c3fc2621 208
e501603b
TO
209 /**
210 * Returns the names of this table
211 *
212 * @return string
213 */
c3fc2621 214 public static function getTableName() {
e501603b
TO
215 return self::$_tableName;
216 }
c3fc2621 217
e501603b
TO
218 /**
219 * Returns if this table needs to be logged
220 *
c3fc2621 221 * @return bool
e501603b 222 */
c3fc2621 223 public function getLog() {
e501603b
TO
224 return self::$_log;
225 }
c3fc2621 226
e501603b
TO
227 /**
228 * Returns the list of fields that can be imported
229 *
230 * @param bool $prefix
231 *
232 * @return array
233 */
c3fc2621
CW
234 public static function &import($prefix = FALSE) {
235 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_account', $prefix, []);
60808919 236 return $r;
e501603b 237 }
c3fc2621 238
e501603b
TO
239 /**
240 * Returns the list of fields that can be exported
241 *
242 * @param bool $prefix
243 *
244 * @return array
245 */
c3fc2621
CW
246 public static function &export($prefix = FALSE) {
247 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_account', $prefix, []);
60808919 248 return $r;
e501603b 249 }
c3fc2621 250
e7a6b91a
AS
251 /**
252 * Returns the list of indices
c3fc2621
CW
253 *
254 * @param bool $localize
255 *
256 * @return array
e7a6b91a
AS
257 */
258 public static function indices($localize = TRUE) {
c3fc2621
CW
259 $indices = [
260 'index_entity_id_entity_table_account_relationship' => [
5b3543ce 261 'name' => 'index_entity_id_entity_table_account_relationship',
c3fc2621 262 'field' => [
5b3543ce
JM
263 0 => 'entity_id',
264 1 => 'entity_table',
265 2 => 'account_relationship',
c3fc2621
CW
266 ],
267 'localizable' => FALSE,
268 'unique' => TRUE,
5b3543ce 269 'sig' => 'civicrm_entity_financial_account::1::entity_id::entity_table::account_relationship',
c3fc2621
CW
270 ],
271 ];
e7a6b91a
AS
272 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
273 }
c3fc2621 274
e501603b 275}