Add "labelField" metadata to entities
[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
8ab43c93 9 * (GenCodeChecksum:e7fe0d109914d345588895ccf1838406)
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 {
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',
120 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 121 'localizable' => 0,
a9d0587b 122 'add' => '4.3',
c3fc2621
CW
123 ],
124 'entity_table' => [
e501603b
TO
125 'name' => 'entity_table',
126 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 127 'title' => ts('Entity Table'),
215b423e 128 'description' => ts('Links to an entity_table like civicrm_financial_type'),
c3fc2621 129 'required' => TRUE,
e501603b
TO
130 'maxlength' => 64,
131 'size' => CRM_Utils_Type::BIG,
c3fc2621 132 'import' => TRUE,
e501603b 133 'where' => 'civicrm_entity_financial_account.entity_table',
c3fc2621 134 'export' => TRUE,
522a26c9 135 'table_name' => 'civicrm_entity_financial_account',
136 'entity' => 'EntityFinancialAccount',
137 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 138 'localizable' => 0,
a9d0587b 139 'add' => '4.3',
c3fc2621
CW
140 ],
141 'entity_id' => [
e501603b
TO
142 'name' => 'entity_id',
143 'type' => CRM_Utils_Type::T_INT,
c3fc2621 144 'title' => ts('Entity ID'),
215b423e 145 'description' => ts('Links to an id in the entity_table, such as vid in civicrm_financial_type'),
c3fc2621 146 'required' => TRUE,
a36434b9 147 'where' => 'civicrm_entity_financial_account.entity_id',
522a26c9 148 'table_name' => 'civicrm_entity_financial_account',
149 'entity' => 'EntityFinancialAccount',
150 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 151 'localizable' => 0,
a9d0587b 152 'add' => '4.3',
c3fc2621
CW
153 ],
154 'account_relationship' => [
e501603b
TO
155 'name' => 'account_relationship',
156 'type' => CRM_Utils_Type::T_INT,
c3fc2621 157 'title' => ts('Account Relationship'),
215b423e 158 'description' => ts('FK to a new civicrm_option_value (account_relationship)'),
c3fc2621 159 'required' => TRUE,
a36434b9 160 'where' => 'civicrm_entity_financial_account.account_relationship',
522a26c9 161 'table_name' => 'civicrm_entity_financial_account',
162 'entity' => 'EntityFinancialAccount',
163 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 164 'localizable' => 0,
c3fc2621 165 'html' => [
e501603b 166 'type' => 'Select',
c3fc2621
CW
167 ],
168 'pseudoconstant' => [
e501603b
TO
169 'optionGroupName' => 'account_relationship',
170 'optionEditPath' => 'civicrm/admin/options/account_relationship',
e6ca0a57 171 ],
a9d0587b 172 'add' => '4.3',
c3fc2621
CW
173 ],
174 'financial_account_id' => [
e501603b
TO
175 'name' => 'financial_account_id',
176 'type' => CRM_Utils_Type::T_INT,
c3fc2621 177 'title' => ts('Financial Account'),
215b423e 178 'description' => ts('FK to the financial_account_id'),
c3fc2621 179 'required' => TRUE,
a36434b9 180 'where' => 'civicrm_entity_financial_account.financial_account_id',
522a26c9 181 'table_name' => 'civicrm_entity_financial_account',
182 'entity' => 'EntityFinancialAccount',
183 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 184 'localizable' => 0,
e501603b 185 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
c3fc2621 186 'html' => [
e501603b 187 'type' => 'Select',
c3fc2621
CW
188 ],
189 'pseudoconstant' => [
e501603b
TO
190 'table' => 'civicrm_financial_account',
191 'keyColumn' => 'id',
192 'labelColumn' => 'name',
e6ca0a57 193 ],
a9d0587b 194 'add' => '4.3',
c3fc2621
CW
195 ],
196 ];
346aaaba 197 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 198 }
346aaaba 199 return Civi::$statics[__CLASS__]['fields'];
e501603b 200 }
c3fc2621 201
e501603b 202 /**
bd8e0b14 203 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
204 *
205 * @return array
bd8e0b14 206 * Array(string $name => string $uniqueName).
e501603b 207 */
c3fc2621 208 public static function &fieldKeys() {
bd8e0b14
TO
209 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
210 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 211 }
bd8e0b14 212 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 213 }
c3fc2621 214
e501603b
TO
215 /**
216 * Returns the names of this table
217 *
218 * @return string
219 */
c3fc2621 220 public static function getTableName() {
e501603b
TO
221 return self::$_tableName;
222 }
c3fc2621 223
e501603b
TO
224 /**
225 * Returns if this table needs to be logged
226 *
c3fc2621 227 * @return bool
e501603b 228 */
c3fc2621 229 public function getLog() {
e501603b
TO
230 return self::$_log;
231 }
c3fc2621 232
e501603b
TO
233 /**
234 * Returns the list of fields that can be imported
235 *
236 * @param bool $prefix
237 *
238 * @return array
239 */
c3fc2621
CW
240 public static function &import($prefix = FALSE) {
241 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_account', $prefix, []);
60808919 242 return $r;
e501603b 243 }
c3fc2621 244
e501603b
TO
245 /**
246 * Returns the list of fields that can be exported
247 *
248 * @param bool $prefix
249 *
250 * @return array
251 */
c3fc2621
CW
252 public static function &export($prefix = FALSE) {
253 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_account', $prefix, []);
60808919 254 return $r;
e501603b 255 }
c3fc2621 256
e7a6b91a
AS
257 /**
258 * Returns the list of indices
c3fc2621
CW
259 *
260 * @param bool $localize
261 *
262 * @return array
e7a6b91a
AS
263 */
264 public static function indices($localize = TRUE) {
c3fc2621
CW
265 $indices = [
266 'index_entity_id_entity_table_account_relationship' => [
5b3543ce 267 'name' => 'index_entity_id_entity_table_account_relationship',
c3fc2621 268 'field' => [
5b3543ce
JM
269 0 => 'entity_id',
270 1 => 'entity_table',
271 2 => 'account_relationship',
c3fc2621
CW
272 ],
273 'localizable' => FALSE,
274 'unique' => TRUE,
5b3543ce 275 'sig' => 'civicrm_entity_financial_account::1::entity_id::entity_table::account_relationship',
c3fc2621
CW
276 ],
277 ];
e7a6b91a
AS
278 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
279 }
c3fc2621 280
e501603b 281}