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