672e3ed366e5fd4e9ed9a8a93d7c3e87e280c358
[civicrm-core.git] / CRM / Financial / DAO / Currency.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Financial/Currency.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:19729d25ea5ad98f3fc2551acab9fa7a)
10 */
11
12 /**
13 * Database access object for the Currency entity.
14 */
15 class CRM_Financial_DAO_Currency extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_currency';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = TRUE;
30
31 /**
32 * Currency Id
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Currency Name
40 *
41 * @var string
42 */
43 public $name;
44
45 /**
46 * Currency Symbol
47 *
48 * @var string
49 */
50 public $symbol;
51
52 /**
53 * Numeric currency code
54 *
55 * @var string
56 */
57 public $numeric_code;
58
59 /**
60 * Full currency name
61 *
62 * @var string
63 */
64 public $full_name;
65
66 /**
67 * Class constructor.
68 */
69 public function __construct() {
70 $this->__table = 'civicrm_currency';
71 parent::__construct();
72 }
73
74 /**
75 * Returns all the column names of this table
76 *
77 * @return array
78 */
79 public static function &fields() {
80 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
81 Civi::$statics[__CLASS__]['fields'] = [
82 'id' => [
83 'name' => 'id',
84 'type' => CRM_Utils_Type::T_INT,
85 'title' => ts('Currency ID'),
86 'description' => ts('Currency Id'),
87 'required' => TRUE,
88 'table_name' => 'civicrm_currency',
89 'entity' => 'Currency',
90 'bao' => 'CRM_Financial_DAO_Currency',
91 'localizable' => 0,
92 ],
93 'name' => [
94 'name' => 'name',
95 'type' => CRM_Utils_Type::T_STRING,
96 'title' => ts('Currency'),
97 'description' => ts('Currency Name'),
98 'maxlength' => 64,
99 'size' => CRM_Utils_Type::BIG,
100 'import' => TRUE,
101 'where' => 'civicrm_currency.name',
102 'headerPattern' => '',
103 'dataPattern' => '',
104 'export' => TRUE,
105 'table_name' => 'civicrm_currency',
106 'entity' => 'Currency',
107 'bao' => 'CRM_Financial_DAO_Currency',
108 'localizable' => 0,
109 'html' => [
110 'type' => 'Text',
111 ],
112 ],
113 'symbol' => [
114 'name' => 'symbol',
115 'type' => CRM_Utils_Type::T_STRING,
116 'title' => ts('Currency Symbol'),
117 'description' => ts('Currency Symbol'),
118 'maxlength' => 8,
119 'size' => CRM_Utils_Type::EIGHT,
120 'table_name' => 'civicrm_currency',
121 'entity' => 'Currency',
122 'bao' => 'CRM_Financial_DAO_Currency',
123 'localizable' => 0,
124 'html' => [
125 'type' => 'Text',
126 ],
127 ],
128 'numeric_code' => [
129 'name' => 'numeric_code',
130 'type' => CRM_Utils_Type::T_STRING,
131 'title' => ts('Currency Numeric Code'),
132 'description' => ts('Numeric currency code'),
133 'maxlength' => 3,
134 'size' => CRM_Utils_Type::FOUR,
135 'import' => TRUE,
136 'where' => 'civicrm_currency.numeric_code',
137 'headerPattern' => '',
138 'dataPattern' => '',
139 'export' => TRUE,
140 'table_name' => 'civicrm_currency',
141 'entity' => 'Currency',
142 'bao' => 'CRM_Financial_DAO_Currency',
143 'localizable' => 0,
144 ],
145 'full_name' => [
146 'name' => 'full_name',
147 'type' => CRM_Utils_Type::T_STRING,
148 'title' => ts('Full Currency Name'),
149 'description' => ts('Full currency name'),
150 'maxlength' => 64,
151 'size' => CRM_Utils_Type::BIG,
152 'table_name' => 'civicrm_currency',
153 'entity' => 'Currency',
154 'bao' => 'CRM_Financial_DAO_Currency',
155 'localizable' => 0,
156 'html' => [
157 'type' => 'Text',
158 ],
159 ],
160 ];
161 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
162 }
163 return Civi::$statics[__CLASS__]['fields'];
164 }
165
166 /**
167 * Return a mapping from field-name to the corresponding key (as used in fields()).
168 *
169 * @return array
170 * Array(string $name => string $uniqueName).
171 */
172 public static function &fieldKeys() {
173 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
174 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
175 }
176 return Civi::$statics[__CLASS__]['fieldKeys'];
177 }
178
179 /**
180 * Returns the names of this table
181 *
182 * @return string
183 */
184 public static function getTableName() {
185 return self::$_tableName;
186 }
187
188 /**
189 * Returns if this table needs to be logged
190 *
191 * @return bool
192 */
193 public function getLog() {
194 return self::$_log;
195 }
196
197 /**
198 * Returns the list of fields that can be imported
199 *
200 * @param bool $prefix
201 *
202 * @return array
203 */
204 public static function &import($prefix = FALSE) {
205 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'currency', $prefix, []);
206 return $r;
207 }
208
209 /**
210 * Returns the list of fields that can be exported
211 *
212 * @param bool $prefix
213 *
214 * @return array
215 */
216 public static function &export($prefix = FALSE) {
217 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'currency', $prefix, []);
218 return $r;
219 }
220
221 /**
222 * Returns the list of indices
223 *
224 * @param bool $localize
225 *
226 * @return array
227 */
228 public static function indices($localize = TRUE) {
229 $indices = [];
230 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
231 }
232
233 }