Commit | Line | Data |
---|---|---|
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 | |
28979d65 | 9 | * (GenCodeChecksum:ee1330d41462e8d7fb84657c4efa47f8) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the EntityFinancialAccount entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Financial_DAO_EntityFinancialAccount extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '4.3'; | |
d31fb4e3 | 18 | const COMPONENT = 'CiviContribute'; |
c3fc2621 | 19 | |
e501603b | 20 | /** |
f41f0342 | 21 | * Static instance to hold the table name. |
e501603b TO |
22 | * |
23 | * @var string | |
24 | */ | |
fa45b5b9 | 25 | public static $_tableName = 'civicrm_entity_financial_account'; |
c3fc2621 | 26 | |
e501603b | 27 | /** |
f41f0342 | 28 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 29 | * |
c3fc2621 | 30 | * @var bool |
e501603b | 31 | */ |
fa45b5b9 | 32 | public static $_log = TRUE; |
c3fc2621 | 33 | |
e501603b TO |
34 | /** |
35 | * ID | |
36 | * | |
28979d65 CW |
37 | * @var int|string|null |
38 | * (SQL type: int unsigned) | |
39 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
40 | */ |
41 | public $id; | |
c3fc2621 | 42 | |
e501603b TO |
43 | /** |
44 | * Links to an entity_table like civicrm_financial_type | |
45 | * | |
46 | * @var string | |
28979d65 CW |
47 | * (SQL type: varchar(64)) |
48 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
49 | */ |
50 | public $entity_table; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Links to an id in the entity_table, such as vid in civicrm_financial_type | |
54 | * | |
28979d65 CW |
55 | * @var int|string |
56 | * (SQL type: int unsigned) | |
57 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
58 | */ |
59 | public $entity_id; | |
c3fc2621 | 60 | |
e501603b TO |
61 | /** |
62 | * FK to a new civicrm_option_value (account_relationship) | |
63 | * | |
28979d65 CW |
64 | * @var int|string |
65 | * (SQL type: int unsigned) | |
66 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
67 | */ |
68 | public $account_relationship; | |
c3fc2621 | 69 | |
e501603b TO |
70 | /** |
71 | * FK to the financial_account_id | |
72 | * | |
28979d65 CW |
73 | * @var int|string |
74 | * (SQL type: int unsigned) | |
75 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
76 | */ |
77 | public $financial_account_id; | |
c3fc2621 | 78 | |
e501603b | 79 | /** |
f41f0342 | 80 | * Class constructor. |
e501603b | 81 | */ |
c3fc2621 | 82 | public function __construct() { |
e501603b TO |
83 | $this->__table = 'civicrm_entity_financial_account'; |
84 | parent::__construct(); | |
85 | } | |
c3fc2621 | 86 | |
449c4e6b CW |
87 | /** |
88 | * Returns localized title of this entity. | |
7b66c3b5 AH |
89 | * |
90 | * @param bool $plural | |
91 | * Whether to return the plural version of the title. | |
449c4e6b | 92 | */ |
7b66c3b5 AH |
93 | public static function getEntityTitle($plural = FALSE) { |
94 | return $plural ? ts('Entity Financial Accounts') : ts('Entity Financial Account'); | |
449c4e6b CW |
95 | } |
96 | ||
e501603b | 97 | /** |
f41f0342 | 98 | * Returns foreign keys and entity references. |
e501603b TO |
99 | * |
100 | * @return array | |
101 | * [CRM_Core_Reference_Interface] | |
102 | */ | |
c3fc2621 | 103 | public static function getReferenceColumns() { |
346aaaba | 104 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 105 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
106 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_account_id', 'civicrm_financial_account', 'id'); |
107 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); | |
346aaaba | 108 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 109 | } |
346aaaba | 110 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 111 | } |
c3fc2621 | 112 | |
e501603b TO |
113 | /** |
114 | * Returns all the column names of this table | |
115 | * | |
116 | * @return array | |
117 | */ | |
c3fc2621 | 118 | public static function &fields() { |
346aaaba | 119 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
120 | Civi::$statics[__CLASS__]['fields'] = [ |
121 | 'id' => [ | |
e501603b TO |
122 | 'name' => 'id', |
123 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 124 | 'title' => ts('Entity Financial Account ID'), |
215b423e | 125 | 'description' => ts('ID'), |
c3fc2621 | 126 | 'required' => TRUE, |
a36434b9 | 127 | 'where' => 'civicrm_entity_financial_account.id', |
522a26c9 | 128 | 'table_name' => 'civicrm_entity_financial_account', |
129 | 'entity' => 'EntityFinancialAccount', | |
37c608f6 | 130 | 'bao' => 'CRM_Financial_BAO_EntityFinancialAccount', |
6a7e5e5d | 131 | 'localizable' => 0, |
2cbbebe8 A |
132 | 'html' => [ |
133 | 'type' => 'Number', | |
134 | ], | |
1fe423d6 | 135 | 'readonly' => TRUE, |
a9d0587b | 136 | 'add' => '4.3', |
c3fc2621 CW |
137 | ], |
138 | 'entity_table' => [ | |
e501603b TO |
139 | 'name' => 'entity_table', |
140 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 141 | 'title' => ts('Entity Table'), |
215b423e | 142 | 'description' => ts('Links to an entity_table like civicrm_financial_type'), |
c3fc2621 | 143 | 'required' => TRUE, |
e501603b TO |
144 | 'maxlength' => 64, |
145 | 'size' => CRM_Utils_Type::BIG, | |
c3fc2621 | 146 | 'import' => TRUE, |
e501603b | 147 | 'where' => 'civicrm_entity_financial_account.entity_table', |
c3fc2621 | 148 | 'export' => TRUE, |
522a26c9 | 149 | 'table_name' => 'civicrm_entity_financial_account', |
150 | 'entity' => 'EntityFinancialAccount', | |
37c608f6 | 151 | 'bao' => 'CRM_Financial_BAO_EntityFinancialAccount', |
6a7e5e5d | 152 | 'localizable' => 0, |
37c608f6 | 153 | 'pseudoconstant' => [ |
154 | 'callback' => 'CRM_Financial_BAO_EntityFinancialAccount::entityTables', | |
155 | ], | |
a9d0587b | 156 | 'add' => '4.3', |
c3fc2621 CW |
157 | ], |
158 | 'entity_id' => [ | |
e501603b TO |
159 | 'name' => 'entity_id', |
160 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 161 | 'title' => ts('Entity ID'), |
215b423e | 162 | 'description' => ts('Links to an id in the entity_table, such as vid in civicrm_financial_type'), |
c3fc2621 | 163 | 'required' => TRUE, |
a36434b9 | 164 | 'where' => 'civicrm_entity_financial_account.entity_id', |
522a26c9 | 165 | 'table_name' => 'civicrm_entity_financial_account', |
166 | 'entity' => 'EntityFinancialAccount', | |
37c608f6 | 167 | 'bao' => 'CRM_Financial_BAO_EntityFinancialAccount', |
6a7e5e5d | 168 | 'localizable' => 0, |
a9d0587b | 169 | 'add' => '4.3', |
c3fc2621 CW |
170 | ], |
171 | 'account_relationship' => [ | |
e501603b TO |
172 | 'name' => 'account_relationship', |
173 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 174 | 'title' => ts('Account Relationship'), |
215b423e | 175 | 'description' => ts('FK to a new civicrm_option_value (account_relationship)'), |
c3fc2621 | 176 | 'required' => TRUE, |
a36434b9 | 177 | 'where' => 'civicrm_entity_financial_account.account_relationship', |
522a26c9 | 178 | 'table_name' => 'civicrm_entity_financial_account', |
179 | 'entity' => 'EntityFinancialAccount', | |
37c608f6 | 180 | 'bao' => 'CRM_Financial_BAO_EntityFinancialAccount', |
6a7e5e5d | 181 | 'localizable' => 0, |
c3fc2621 | 182 | 'html' => [ |
e501603b | 183 | 'type' => 'Select', |
c3fc2621 CW |
184 | ], |
185 | 'pseudoconstant' => [ | |
e501603b TO |
186 | 'optionGroupName' => 'account_relationship', |
187 | 'optionEditPath' => 'civicrm/admin/options/account_relationship', | |
e6ca0a57 | 188 | ], |
a9d0587b | 189 | 'add' => '4.3', |
c3fc2621 CW |
190 | ], |
191 | 'financial_account_id' => [ | |
e501603b TO |
192 | 'name' => 'financial_account_id', |
193 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 194 | 'title' => ts('Financial Account ID'), |
215b423e | 195 | 'description' => ts('FK to the financial_account_id'), |
c3fc2621 | 196 | 'required' => TRUE, |
a36434b9 | 197 | 'where' => 'civicrm_entity_financial_account.financial_account_id', |
522a26c9 | 198 | 'table_name' => 'civicrm_entity_financial_account', |
199 | 'entity' => 'EntityFinancialAccount', | |
37c608f6 | 200 | 'bao' => 'CRM_Financial_BAO_EntityFinancialAccount', |
6a7e5e5d | 201 | 'localizable' => 0, |
e501603b | 202 | 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', |
c3fc2621 | 203 | 'html' => [ |
e501603b | 204 | 'type' => 'Select', |
2cbbebe8 | 205 | 'label' => ts("Financial Account"), |
c3fc2621 CW |
206 | ], |
207 | 'pseudoconstant' => [ | |
e501603b TO |
208 | 'table' => 'civicrm_financial_account', |
209 | 'keyColumn' => 'id', | |
210 | 'labelColumn' => 'name', | |
e6ca0a57 | 211 | ], |
a9d0587b | 212 | 'add' => '4.3', |
c3fc2621 CW |
213 | ], |
214 | ]; | |
346aaaba | 215 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 216 | } |
346aaaba | 217 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 218 | } |
c3fc2621 | 219 | |
e501603b | 220 | /** |
bd8e0b14 | 221 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
222 | * |
223 | * @return array | |
bd8e0b14 | 224 | * Array(string $name => string $uniqueName). |
e501603b | 225 | */ |
c3fc2621 | 226 | public static function &fieldKeys() { |
bd8e0b14 TO |
227 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
228 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 229 | } |
bd8e0b14 | 230 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 231 | } |
c3fc2621 | 232 | |
e501603b TO |
233 | /** |
234 | * Returns the names of this table | |
235 | * | |
236 | * @return string | |
237 | */ | |
c3fc2621 | 238 | public static function getTableName() { |
e501603b TO |
239 | return self::$_tableName; |
240 | } | |
c3fc2621 | 241 | |
e501603b TO |
242 | /** |
243 | * Returns if this table needs to be logged | |
244 | * | |
c3fc2621 | 245 | * @return bool |
e501603b | 246 | */ |
c3fc2621 | 247 | public function getLog() { |
e501603b TO |
248 | return self::$_log; |
249 | } | |
c3fc2621 | 250 | |
e501603b TO |
251 | /** |
252 | * Returns the list of fields that can be imported | |
253 | * | |
254 | * @param bool $prefix | |
255 | * | |
256 | * @return array | |
257 | */ | |
c3fc2621 CW |
258 | public static function &import($prefix = FALSE) { |
259 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_account', $prefix, []); | |
60808919 | 260 | return $r; |
e501603b | 261 | } |
c3fc2621 | 262 | |
e501603b TO |
263 | /** |
264 | * Returns the list of fields that can be exported | |
265 | * | |
266 | * @param bool $prefix | |
267 | * | |
268 | * @return array | |
269 | */ | |
c3fc2621 CW |
270 | public static function &export($prefix = FALSE) { |
271 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_account', $prefix, []); | |
60808919 | 272 | return $r; |
e501603b | 273 | } |
c3fc2621 | 274 | |
e7a6b91a AS |
275 | /** |
276 | * Returns the list of indices | |
c3fc2621 CW |
277 | * |
278 | * @param bool $localize | |
279 | * | |
280 | * @return array | |
e7a6b91a AS |
281 | */ |
282 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
283 | $indices = [ |
284 | 'index_entity_id_entity_table_account_relationship' => [ | |
5b3543ce | 285 | 'name' => 'index_entity_id_entity_table_account_relationship', |
c3fc2621 | 286 | 'field' => [ |
5b3543ce JM |
287 | 0 => 'entity_id', |
288 | 1 => 'entity_table', | |
289 | 2 => 'account_relationship', | |
c3fc2621 CW |
290 | ], |
291 | 'localizable' => FALSE, | |
292 | 'unique' => TRUE, | |
5b3543ce | 293 | 'sig' => 'civicrm_entity_financial_account::1::entity_id::entity_table::account_relationship', |
c3fc2621 CW |
294 | ], |
295 | ]; | |
e7a6b91a AS |
296 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
297 | } | |
c3fc2621 | 298 | |
e501603b | 299 | } |