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