Declare API Key as a protected field for future use
[civicrm-core.git] / CRM / Financial / DAO / EntityFinancialAccount.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Financial/EntityFinancialAccount.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:963386176a420f8b537e1954bcc17540)
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 unsigned
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 unsigned
49 */
50 public $entity_id;
51
52 /**
53 * FK to a new civicrm_option_value (account_relationship)
54 *
55 * @var int unsigned
56 */
57 public $account_relationship;
58
59 /**
60 * FK to the financial_account_id
61 *
62 * @var int unsigned
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 foreign keys and entity references.
76 *
77 * @return array
78 * [CRM_Core_Reference_Interface]
79 */
80 public static function getReferenceColumns() {
81 if (!isset(Civi::$statics[__CLASS__]['links'])) {
82 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
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');
85 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
86 }
87 return Civi::$statics[__CLASS__]['links'];
88 }
89
90 /**
91 * Returns all the column names of this table
92 *
93 * @return array
94 */
95 public static function &fields() {
96 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
97 Civi::$statics[__CLASS__]['fields'] = [
98 'id' => [
99 'name' => 'id',
100 'type' => CRM_Utils_Type::T_INT,
101 'title' => ts('Entity Financial Account ID'),
102 'description' => ts('ID'),
103 'required' => TRUE,
104 'where' => 'civicrm_entity_financial_account.id',
105 'table_name' => 'civicrm_entity_financial_account',
106 'entity' => 'EntityFinancialAccount',
107 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
108 'localizable' => 0,
109 ],
110 'entity_table' => [
111 'name' => 'entity_table',
112 'type' => CRM_Utils_Type::T_STRING,
113 'title' => ts('Entity Table'),
114 'description' => ts('Links to an entity_table like civicrm_financial_type'),
115 'required' => TRUE,
116 'maxlength' => 64,
117 'size' => CRM_Utils_Type::BIG,
118 'import' => TRUE,
119 'where' => 'civicrm_entity_financial_account.entity_table',
120 'export' => TRUE,
121 'table_name' => 'civicrm_entity_financial_account',
122 'entity' => 'EntityFinancialAccount',
123 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
124 'localizable' => 0,
125 ],
126 'entity_id' => [
127 'name' => 'entity_id',
128 'type' => CRM_Utils_Type::T_INT,
129 'title' => ts('Entity ID'),
130 'description' => ts('Links to an id in the entity_table, such as vid in civicrm_financial_type'),
131 'required' => TRUE,
132 'where' => 'civicrm_entity_financial_account.entity_id',
133 'table_name' => 'civicrm_entity_financial_account',
134 'entity' => 'EntityFinancialAccount',
135 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
136 'localizable' => 0,
137 ],
138 'account_relationship' => [
139 'name' => 'account_relationship',
140 'type' => CRM_Utils_Type::T_INT,
141 'title' => ts('Account Relationship'),
142 'description' => ts('FK to a new civicrm_option_value (account_relationship)'),
143 'required' => TRUE,
144 'where' => 'civicrm_entity_financial_account.account_relationship',
145 'table_name' => 'civicrm_entity_financial_account',
146 'entity' => 'EntityFinancialAccount',
147 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
148 'localizable' => 0,
149 'html' => [
150 'type' => 'Select',
151 ],
152 'pseudoconstant' => [
153 'optionGroupName' => 'account_relationship',
154 'optionEditPath' => 'civicrm/admin/options/account_relationship',
155 ]
156 ],
157 'financial_account_id' => [
158 'name' => 'financial_account_id',
159 'type' => CRM_Utils_Type::T_INT,
160 'title' => ts('Financial Account'),
161 'description' => ts('FK to the financial_account_id'),
162 'required' => TRUE,
163 'where' => 'civicrm_entity_financial_account.financial_account_id',
164 'table_name' => 'civicrm_entity_financial_account',
165 'entity' => 'EntityFinancialAccount',
166 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
167 'localizable' => 0,
168 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
169 'html' => [
170 'type' => 'Select',
171 ],
172 'pseudoconstant' => [
173 'table' => 'civicrm_financial_account',
174 'keyColumn' => 'id',
175 'labelColumn' => 'name',
176 ]
177 ],
178 ];
179 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
180 }
181 return Civi::$statics[__CLASS__]['fields'];
182 }
183
184 /**
185 * Return a mapping from field-name to the corresponding key (as used in fields()).
186 *
187 * @return array
188 * Array(string $name => string $uniqueName).
189 */
190 public static function &fieldKeys() {
191 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
192 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
193 }
194 return Civi::$statics[__CLASS__]['fieldKeys'];
195 }
196
197 /**
198 * Returns the names of this table
199 *
200 * @return string
201 */
202 public static function getTableName() {
203 return self::$_tableName;
204 }
205
206 /**
207 * Returns if this table needs to be logged
208 *
209 * @return bool
210 */
211 public function getLog() {
212 return self::$_log;
213 }
214
215 /**
216 * Returns the list of fields that can be imported
217 *
218 * @param bool $prefix
219 *
220 * @return array
221 */
222 public static function &import($prefix = FALSE) {
223 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_account', $prefix, []);
224 return $r;
225 }
226
227 /**
228 * Returns the list of fields that can be exported
229 *
230 * @param bool $prefix
231 *
232 * @return array
233 */
234 public static function &export($prefix = FALSE) {
235 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_account', $prefix, []);
236 return $r;
237 }
238
239 /**
240 * Returns the list of indices
241 *
242 * @param bool $localize
243 *
244 * @return array
245 */
246 public static function indices($localize = TRUE) {
247 $indices = [
248 'index_entity_id_entity_table_account_relationship' => [
249 'name' => 'index_entity_id_entity_table_account_relationship',
250 'field' => [
251 0 => 'entity_id',
252 1 => 'entity_table',
253 2 => 'account_relationship',
254 ],
255 'localizable' => FALSE,
256 'unique' => TRUE,
257 'sig' => 'civicrm_entity_financial_account::1::entity_id::entity_table::account_relationship',
258 ],
259 ];
260 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
261 }
262
263 }