CRM-19130 - xml/templates/dao.tpl - Fire events for fields() and links()
[civicrm-core.git] / CRM / Financial / DAO / EntityFinancialAccount.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Financial/EntityFinancialAccount.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:13b6c60f03bc97b4cd018e009e43fbf9)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Financial_DAO_EntityFinancialAccount extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_entity_financial_account';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
e501603b
TO
50 /**
51 * static instance to hold the FK relationships
52 *
53 * @var string
54 */
55 static $_links = null;
e501603b
TO
56 /**
57 * static value to see if we should log any modifications to
58 * this table in the civicrm_log table
59 *
60 * @var boolean
61 */
62 static $_log = true;
63 /**
64 * ID
65 *
66 * @var int unsigned
67 */
68 public $id;
69 /**
70 * Links to an entity_table like civicrm_financial_type
71 *
72 * @var string
73 */
74 public $entity_table;
75 /**
76 * Links to an id in the entity_table, such as vid in civicrm_financial_type
77 *
78 * @var int unsigned
79 */
80 public $entity_id;
81 /**
82 * FK to a new civicrm_option_value (account_relationship)
83 *
84 * @var int unsigned
85 */
86 public $account_relationship;
87 /**
88 * FK to the financial_account_id
89 *
90 * @var int unsigned
91 */
92 public $financial_account_id;
93 /**
94 * class constructor
95 *
96 * @return civicrm_entity_financial_account
97 */
98 function __construct() {
99 $this->__table = 'civicrm_entity_financial_account';
100 parent::__construct();
101 }
102 /**
103 * Returns foreign keys and entity references
104 *
105 * @return array
106 * [CRM_Core_Reference_Interface]
107 */
108 static function getReferenceColumns() {
109 if (!self::$_links) {
110 self::$_links = static ::createReferenceColumns(__CLASS__);
111 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_account_id', 'civicrm_financial_account', 'id');
112 self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
113 }
114 return self::$_links;
115 }
116 /**
117 * Returns all the column names of this table
118 *
119 * @return array
120 */
121 static function &fields() {
122 if (!(self::$_fields)) {
123 self::$_fields = array(
124 'id' => array(
125 'name' => 'id',
126 'type' => CRM_Utils_Type::T_INT,
127 'title' => ts('Entity Financial Account ID') ,
128 'description' => 'ID',
129 'required' => true,
130 ) ,
131 'entity_table' => array(
132 'name' => 'entity_table',
133 'type' => CRM_Utils_Type::T_STRING,
134 'title' => ts('Entity Table') ,
135 'description' => 'Links to an entity_table like civicrm_financial_type',
136 'required' => true,
137 'maxlength' => 64,
138 'size' => CRM_Utils_Type::BIG,
139 'import' => true,
140 'where' => 'civicrm_entity_financial_account.entity_table',
141 'headerPattern' => '',
142 'dataPattern' => '',
143 'export' => true,
144 ) ,
145 'entity_id' => array(
146 'name' => 'entity_id',
147 'type' => CRM_Utils_Type::T_INT,
148 'title' => ts('Entity ID') ,
149 'description' => 'Links to an id in the entity_table, such as vid in civicrm_financial_type',
150 'required' => true,
151 ) ,
152 'account_relationship' => array(
153 'name' => 'account_relationship',
154 'type' => CRM_Utils_Type::T_INT,
155 'title' => ts('Account Relationship') ,
156 'description' => 'FK to a new civicrm_option_value (account_relationship)',
157 'required' => true,
158 'html' => array(
159 'type' => 'Select',
160 ) ,
161 'pseudoconstant' => array(
162 'optionGroupName' => 'account_relationship',
163 'optionEditPath' => 'civicrm/admin/options/account_relationship',
164 )
165 ) ,
166 'financial_account_id' => array(
167 'name' => 'financial_account_id',
168 'type' => CRM_Utils_Type::T_INT,
169 'title' => ts('Financial Account') ,
170 'description' => 'FK to the financial_account_id',
171 'required' => true,
172 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
173 'html' => array(
174 'type' => 'Select',
175 ) ,
176 'pseudoconstant' => array(
177 'table' => 'civicrm_financial_account',
178 'keyColumn' => 'id',
179 'labelColumn' => 'name',
180 )
181 ) ,
182 );
183 }
184 return self::$_fields;
185 }
186 /**
bd8e0b14 187 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
188 *
189 * @return array
bd8e0b14 190 * Array(string $name => string $uniqueName).
e501603b
TO
191 */
192 static function &fieldKeys() {
bd8e0b14
TO
193 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
194 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 195 }
bd8e0b14 196 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
197 }
198 /**
199 * Returns the names of this table
200 *
201 * @return string
202 */
203 static function getTableName() {
204 return self::$_tableName;
205 }
206 /**
207 * Returns if this table needs to be logged
208 *
209 * @return boolean
210 */
211 function getLog() {
212 return self::$_log;
213 }
214 /**
215 * Returns the list of fields that can be imported
216 *
217 * @param bool $prefix
218 *
219 * @return array
220 */
221 static function &import($prefix = false) {
60808919
TO
222 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_account', $prefix, array());
223 return $r;
e501603b
TO
224 }
225 /**
226 * Returns the list of fields that can be exported
227 *
228 * @param bool $prefix
229 *
230 * @return array
231 */
232 static function &export($prefix = false) {
60808919
TO
233 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_account', $prefix, array());
234 return $r;
e501603b
TO
235 }
236}