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