Merge pull request #17179 from mattwire/addpaymentprocessortorecurlist
[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:52f632fb4083dc1e94f1d252a4eeec99)
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 ],
117 'entity_table' => [
118 'name' => 'entity_table',
119 'type' => CRM_Utils_Type::T_STRING,
120 'title' => ts('Entity Table'),
121 'description' => ts('Links to an entity_table like civicrm_financial_type'),
122 'required' => TRUE,
123 'maxlength' => 64,
124 'size' => CRM_Utils_Type::BIG,
125 'import' => TRUE,
126 'where' => 'civicrm_entity_financial_account.entity_table',
127 'export' => TRUE,
128 'table_name' => 'civicrm_entity_financial_account',
129 'entity' => 'EntityFinancialAccount',
130 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
131 'localizable' => 0,
132 ],
133 'entity_id' => [
134 'name' => 'entity_id',
135 'type' => CRM_Utils_Type::T_INT,
136 'title' => ts('Entity ID'),
137 'description' => ts('Links to an id in the entity_table, such as vid in civicrm_financial_type'),
138 'required' => TRUE,
139 'where' => 'civicrm_entity_financial_account.entity_id',
140 'table_name' => 'civicrm_entity_financial_account',
141 'entity' => 'EntityFinancialAccount',
142 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
143 'localizable' => 0,
144 ],
145 'account_relationship' => [
146 'name' => 'account_relationship',
147 'type' => CRM_Utils_Type::T_INT,
148 'title' => ts('Account Relationship'),
149 'description' => ts('FK to a new civicrm_option_value (account_relationship)'),
150 'required' => TRUE,
151 'where' => 'civicrm_entity_financial_account.account_relationship',
152 'table_name' => 'civicrm_entity_financial_account',
153 'entity' => 'EntityFinancialAccount',
154 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
155 'localizable' => 0,
156 'html' => [
157 'type' => 'Select',
158 ],
159 'pseudoconstant' => [
160 'optionGroupName' => 'account_relationship',
161 'optionEditPath' => 'civicrm/admin/options/account_relationship',
162 ],
163 ],
164 'financial_account_id' => [
165 'name' => 'financial_account_id',
166 'type' => CRM_Utils_Type::T_INT,
167 'title' => ts('Financial Account'),
168 'description' => ts('FK to the financial_account_id'),
169 'required' => TRUE,
170 'where' => 'civicrm_entity_financial_account.financial_account_id',
171 'table_name' => 'civicrm_entity_financial_account',
172 'entity' => 'EntityFinancialAccount',
173 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
174 'localizable' => 0,
175 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
176 'html' => [
177 'type' => 'Select',
178 ],
179 'pseudoconstant' => [
180 'table' => 'civicrm_financial_account',
181 'keyColumn' => 'id',
182 'labelColumn' => 'name',
183 ],
184 ],
185 ];
186 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
187 }
188 return Civi::$statics[__CLASS__]['fields'];
189 }
190
191 /**
192 * Return a mapping from field-name to the corresponding key (as used in fields()).
193 *
194 * @return array
195 * Array(string $name => string $uniqueName).
196 */
197 public static function &fieldKeys() {
198 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
199 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
200 }
201 return Civi::$statics[__CLASS__]['fieldKeys'];
202 }
203
204 /**
205 * Returns the names of this table
206 *
207 * @return string
208 */
209 public static function getTableName() {
210 return self::$_tableName;
211 }
212
213 /**
214 * Returns if this table needs to be logged
215 *
216 * @return bool
217 */
218 public function getLog() {
219 return self::$_log;
220 }
221
222 /**
223 * Returns the list of fields that can be imported
224 *
225 * @param bool $prefix
226 *
227 * @return array
228 */
229 public static function &import($prefix = FALSE) {
230 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_account', $prefix, []);
231 return $r;
232 }
233
234 /**
235 * Returns the list of fields that can be exported
236 *
237 * @param bool $prefix
238 *
239 * @return array
240 */
241 public static function &export($prefix = FALSE) {
242 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_account', $prefix, []);
243 return $r;
244 }
245
246 /**
247 * Returns the list of indices
248 *
249 * @param bool $localize
250 *
251 * @return array
252 */
253 public static function indices($localize = TRUE) {
254 $indices = [
255 'index_entity_id_entity_table_account_relationship' => [
256 'name' => 'index_entity_id_entity_table_account_relationship',
257 'field' => [
258 0 => 'entity_id',
259 1 => 'entity_table',
260 2 => 'account_relationship',
261 ],
262 'localizable' => FALSE,
263 'unique' => TRUE,
264 'sig' => 'civicrm_entity_financial_account::1::entity_id::entity_table::account_relationship',
265 ],
266 ];
267 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
268 }
269
270 }