Merge pull request #12270 from eileenmcnaughton/systememail
[civicrm-core.git] / CRM / Financial / DAO / EntityFinancialAccount.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Financial/EntityFinancialAccount.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
5b3543ce 9 * (GenCodeChecksum:b9e9a095e5a6631dd7104828d40ec55a)
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 */
22 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 */
c3fc2621
CW
29 static $_log = TRUE;
30
e501603b
TO
31 /**
32 * ID
33 *
34 * @var int unsigned
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 *
48 * @var int unsigned
49 */
50 public $entity_id;
c3fc2621 51
e501603b
TO
52 /**
53 * FK to a new civicrm_option_value (account_relationship)
54 *
55 * @var int unsigned
56 */
57 public $account_relationship;
c3fc2621 58
e501603b
TO
59 /**
60 * FK to the financial_account_id
61 *
62 * @var int unsigned
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
e501603b 74 /**
f41f0342 75 * Returns foreign keys and entity references.
e501603b
TO
76 *
77 * @return array
78 * [CRM_Core_Reference_Interface]
79 */
c3fc2621 80 public static function getReferenceColumns() {
346aaaba
TO
81 if (!isset(Civi::$statics[__CLASS__]['links'])) {
82 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
c3fc2621
CW
83 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_account_id', 'civicrm_financial_account', 'id');
84 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 85 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 86 }
346aaaba 87 return Civi::$statics[__CLASS__]['links'];
e501603b 88 }
c3fc2621 89
e501603b
TO
90 /**
91 * Returns all the column names of this table
92 *
93 * @return array
94 */
c3fc2621 95 public static function &fields() {
346aaaba 96 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
97 Civi::$statics[__CLASS__]['fields'] = [
98 'id' => [
e501603b
TO
99 'name' => 'id',
100 'type' => CRM_Utils_Type::T_INT,
c3fc2621 101 'title' => ts('Entity Financial Account ID'),
e501603b 102 'description' => 'ID',
c3fc2621 103 'required' => TRUE,
522a26c9 104 'table_name' => 'civicrm_entity_financial_account',
105 'entity' => 'EntityFinancialAccount',
106 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 107 'localizable' => 0,
c3fc2621
CW
108 ],
109 'entity_table' => [
e501603b
TO
110 'name' => 'entity_table',
111 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 112 'title' => ts('Entity Table'),
e501603b 113 'description' => 'Links to an entity_table like civicrm_financial_type',
c3fc2621 114 'required' => TRUE,
e501603b
TO
115 'maxlength' => 64,
116 'size' => CRM_Utils_Type::BIG,
c3fc2621 117 'import' => TRUE,
e501603b
TO
118 'where' => 'civicrm_entity_financial_account.entity_table',
119 'headerPattern' => '',
120 'dataPattern' => '',
c3fc2621 121 'export' => TRUE,
522a26c9 122 'table_name' => 'civicrm_entity_financial_account',
123 'entity' => 'EntityFinancialAccount',
124 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 125 'localizable' => 0,
c3fc2621
CW
126 ],
127 'entity_id' => [
e501603b
TO
128 'name' => 'entity_id',
129 'type' => CRM_Utils_Type::T_INT,
c3fc2621 130 'title' => ts('Entity ID'),
e501603b 131 'description' => 'Links to an id in the entity_table, such as vid in civicrm_financial_type',
c3fc2621 132 'required' => TRUE,
522a26c9 133 'table_name' => 'civicrm_entity_financial_account',
134 'entity' => 'EntityFinancialAccount',
135 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 136 'localizable' => 0,
c3fc2621
CW
137 ],
138 'account_relationship' => [
e501603b
TO
139 'name' => 'account_relationship',
140 'type' => CRM_Utils_Type::T_INT,
c3fc2621 141 'title' => ts('Account Relationship'),
e501603b 142 'description' => 'FK to a new civicrm_option_value (account_relationship)',
c3fc2621 143 'required' => TRUE,
522a26c9 144 'table_name' => 'civicrm_entity_financial_account',
145 'entity' => 'EntityFinancialAccount',
146 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 147 'localizable' => 0,
c3fc2621 148 'html' => [
e501603b 149 'type' => 'Select',
c3fc2621
CW
150 ],
151 'pseudoconstant' => [
e501603b
TO
152 'optionGroupName' => 'account_relationship',
153 'optionEditPath' => 'civicrm/admin/options/account_relationship',
c3fc2621
CW
154 ]
155 ],
156 'financial_account_id' => [
e501603b
TO
157 'name' => 'financial_account_id',
158 'type' => CRM_Utils_Type::T_INT,
c3fc2621 159 'title' => ts('Financial Account'),
e501603b 160 'description' => 'FK to the financial_account_id',
c3fc2621 161 'required' => TRUE,
522a26c9 162 'table_name' => 'civicrm_entity_financial_account',
163 'entity' => 'EntityFinancialAccount',
164 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount',
6a7e5e5d 165 'localizable' => 0,
e501603b 166 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
c3fc2621 167 'html' => [
e501603b 168 'type' => 'Select',
c3fc2621
CW
169 ],
170 'pseudoconstant' => [
e501603b
TO
171 'table' => 'civicrm_financial_account',
172 'keyColumn' => 'id',
173 'labelColumn' => 'name',
c3fc2621
CW
174 ]
175 ],
176 ];
346aaaba 177 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 178 }
346aaaba 179 return Civi::$statics[__CLASS__]['fields'];
e501603b 180 }
c3fc2621 181
e501603b 182 /**
bd8e0b14 183 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
184 *
185 * @return array
bd8e0b14 186 * Array(string $name => string $uniqueName).
e501603b 187 */
c3fc2621 188 public static function &fieldKeys() {
bd8e0b14
TO
189 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
190 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 191 }
bd8e0b14 192 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 193 }
c3fc2621 194
e501603b
TO
195 /**
196 * Returns the names of this table
197 *
198 * @return string
199 */
c3fc2621 200 public static function getTableName() {
e501603b
TO
201 return self::$_tableName;
202 }
c3fc2621 203
e501603b
TO
204 /**
205 * Returns if this table needs to be logged
206 *
c3fc2621 207 * @return bool
e501603b 208 */
c3fc2621 209 public function getLog() {
e501603b
TO
210 return self::$_log;
211 }
c3fc2621 212
e501603b
TO
213 /**
214 * Returns the list of fields that can be imported
215 *
216 * @param bool $prefix
217 *
218 * @return array
219 */
c3fc2621
CW
220 public static function &import($prefix = FALSE) {
221 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_account', $prefix, []);
60808919 222 return $r;
e501603b 223 }
c3fc2621 224
e501603b
TO
225 /**
226 * Returns the list of fields that can be exported
227 *
228 * @param bool $prefix
229 *
230 * @return array
231 */
c3fc2621
CW
232 public static function &export($prefix = FALSE) {
233 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_account', $prefix, []);
60808919 234 return $r;
e501603b 235 }
c3fc2621 236
e7a6b91a
AS
237 /**
238 * Returns the list of indices
c3fc2621
CW
239 *
240 * @param bool $localize
241 *
242 * @return array
e7a6b91a
AS
243 */
244 public static function indices($localize = TRUE) {
c3fc2621
CW
245 $indices = [
246 'index_entity_id_entity_table_account_relationship' => [
5b3543ce 247 'name' => 'index_entity_id_entity_table_account_relationship',
c3fc2621 248 'field' => [
5b3543ce
JM
249 0 => 'entity_id',
250 1 => 'entity_table',
251 2 => 'account_relationship',
c3fc2621
CW
252 ],
253 'localizable' => FALSE,
254 'unique' => TRUE,
5b3543ce 255 'sig' => 'civicrm_entity_financial_account::1::entity_id::entity_table::account_relationship',
c3fc2621
CW
256 ],
257 ];
e7a6b91a
AS
258 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
259 }
c3fc2621 260
e501603b 261}