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