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