xml/templates/dao.tpl - Centralize export() / import() logic
[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;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = true;
83 /**
84 * ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * Links to an entity_table like civicrm_financial_type
91 *
92 * @var string
93 */
94 public $entity_table;
95 /**
96 * Links to an id in the entity_table, such as vid in civicrm_financial_type
97 *
98 * @var int unsigned
99 */
100 public $entity_id;
101 /**
102 * FK to a new civicrm_option_value (account_relationship)
103 *
104 * @var int unsigned
105 */
106 public $account_relationship;
107 /**
108 * FK to the financial_account_id
109 *
110 * @var int unsigned
111 */
112 public $financial_account_id;
113 /**
114 * class constructor
115 *
116 * @return civicrm_entity_financial_account
117 */
118 function __construct() {
119 $this->__table = 'civicrm_entity_financial_account';
120 parent::__construct();
121 }
122 /**
123 * Returns foreign keys and entity references
124 *
125 * @return array
126 * [CRM_Core_Reference_Interface]
127 */
128 static function getReferenceColumns() {
129 if (!self::$_links) {
130 self::$_links = static ::createReferenceColumns(__CLASS__);
131 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_account_id', 'civicrm_financial_account', 'id');
132 self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
133 }
134 return self::$_links;
135 }
136 /**
137 * Returns all the column names of this table
138 *
139 * @return array
140 */
141 static function &fields() {
142 if (!(self::$_fields)) {
143 self::$_fields = array(
144 'id' => array(
145 'name' => 'id',
146 'type' => CRM_Utils_Type::T_INT,
147 'title' => ts('Entity Financial Account ID') ,
148 'description' => 'ID',
149 'required' => true,
150 ) ,
151 'entity_table' => array(
152 'name' => 'entity_table',
153 'type' => CRM_Utils_Type::T_STRING,
154 'title' => ts('Entity Table') ,
155 'description' => 'Links to an entity_table like civicrm_financial_type',
156 'required' => true,
157 'maxlength' => 64,
158 'size' => CRM_Utils_Type::BIG,
159 'import' => true,
160 'where' => 'civicrm_entity_financial_account.entity_table',
161 'headerPattern' => '',
162 'dataPattern' => '',
163 'export' => true,
164 ) ,
165 'entity_id' => array(
166 'name' => 'entity_id',
167 'type' => CRM_Utils_Type::T_INT,
168 'title' => ts('Entity ID') ,
169 'description' => 'Links to an id in the entity_table, such as vid in civicrm_financial_type',
170 'required' => true,
171 ) ,
172 'account_relationship' => array(
173 'name' => 'account_relationship',
174 'type' => CRM_Utils_Type::T_INT,
175 'title' => ts('Account Relationship') ,
176 'description' => 'FK to a new civicrm_option_value (account_relationship)',
177 'required' => true,
178 'html' => array(
179 'type' => 'Select',
180 ) ,
181 'pseudoconstant' => array(
182 'optionGroupName' => 'account_relationship',
183 'optionEditPath' => 'civicrm/admin/options/account_relationship',
184 )
185 ) ,
186 'financial_account_id' => array(
187 'name' => 'financial_account_id',
188 'type' => CRM_Utils_Type::T_INT,
189 'title' => ts('Financial Account') ,
190 'description' => 'FK to the financial_account_id',
191 'required' => true,
192 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount',
193 'html' => array(
194 'type' => 'Select',
195 ) ,
196 'pseudoconstant' => array(
197 'table' => 'civicrm_financial_account',
198 'keyColumn' => 'id',
199 'labelColumn' => 'name',
200 )
201 ) ,
202 );
203 }
204 return self::$_fields;
205 }
206 /**
207 * Returns an array containing, for each field, the arary key used for that
208 * field in self::$_fields.
209 *
210 * @return array
211 */
212 static function &fieldKeys() {
213 if (!(self::$_fieldKeys)) {
214 self::$_fieldKeys = array(
215 'id' => 'id',
216 'entity_table' => 'entity_table',
217 'entity_id' => 'entity_id',
218 'account_relationship' => 'account_relationship',
219 'financial_account_id' => 'financial_account_id',
220 );
221 }
222 return self::$_fieldKeys;
223 }
224 /**
225 * Returns the names of this table
226 *
227 * @return string
228 */
229 static function getTableName() {
230 return self::$_tableName;
231 }
232 /**
233 * Returns if this table needs to be logged
234 *
235 * @return boolean
236 */
237 function getLog() {
238 return self::$_log;
239 }
240 /**
241 * Returns the list of fields that can be imported
242 *
243 * @param bool $prefix
244 *
245 * @return array
246 */
247 static function &import($prefix = false) {
248 if (!(self::$_import)) {
249 self::$_import = array();
250 $fields = self::fields();
251 foreach($fields as $name => $field) {
252 if (CRM_Utils_Array::value('import', $field)) {
253 if ($prefix) {
254 self::$_import['entity_financial_account'] = & $fields[$name];
255 } else {
256 self::$_import[$name] = & $fields[$name];
257 }
258 }
259 }
260 }
261 return self::$_import;
262 }
263 /**
264 * Returns the list of fields that can be exported
265 *
266 * @param bool $prefix
267 *
268 * @return array
269 */
270 static function &export($prefix = false) {
271 if (!(self::$_export)) {
272 self::$_export = array();
273 $fields = self::fields();
274 foreach($fields as $name => $field) {
275 if (CRM_Utils_Array::value('export', $field)) {
276 if ($prefix) {
277 self::$_export['entity_financial_account'] = & $fields[$name];
278 } else {
279 self::$_export[$name] = & $fields[$name];
280 }
281 }
282 }
283 }
284 return self::$_export;
285 }
286}