API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Financial / DAO / Currency.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Financial/Currency.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:9141d433586789f5ea9003fdbe9fdf9b)
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
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 localized title of this entity.
76 */
77 public static function getEntityTitle() {
78 return ts('Currencies');
79 }
80
81 /**
82 * Returns all the column names of this table
83 *
84 * @return array
85 */
86 public static function &fields() {
87 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
88 Civi::$statics[__CLASS__]['fields'] = [
89 'id' => [
90 'name' => 'id',
91 'type' => CRM_Utils_Type::T_INT,
92 'title' => ts('Currency ID'),
93 'description' => ts('Currency Id'),
94 'required' => TRUE,
95 'where' => 'civicrm_currency.id',
96 'table_name' => 'civicrm_currency',
97 'entity' => 'Currency',
98 'bao' => 'CRM_Financial_DAO_Currency',
99 'localizable' => 0,
100 'add' => '1.7',
101 ],
102 'name' => [
103 'name' => 'name',
104 'type' => CRM_Utils_Type::T_STRING,
105 'title' => ts('Currency'),
106 'description' => ts('Currency Name'),
107 'maxlength' => 64,
108 'size' => CRM_Utils_Type::BIG,
109 'import' => TRUE,
110 'where' => 'civicrm_currency.name',
111 'export' => TRUE,
112 'table_name' => 'civicrm_currency',
113 'entity' => 'Currency',
114 'bao' => 'CRM_Financial_DAO_Currency',
115 'localizable' => 0,
116 'html' => [
117 'type' => 'Text',
118 ],
119 'add' => '1.7',
120 ],
121 'symbol' => [
122 'name' => 'symbol',
123 'type' => CRM_Utils_Type::T_STRING,
124 'title' => ts('Currency Symbol'),
125 'description' => ts('Currency Symbol'),
126 'maxlength' => 8,
127 'size' => CRM_Utils_Type::EIGHT,
128 'where' => 'civicrm_currency.symbol',
129 'table_name' => 'civicrm_currency',
130 'entity' => 'Currency',
131 'bao' => 'CRM_Financial_DAO_Currency',
132 'localizable' => 0,
133 'html' => [
134 'type' => 'Text',
135 ],
136 'add' => '1.7',
137 ],
138 'numeric_code' => [
139 'name' => 'numeric_code',
140 'type' => CRM_Utils_Type::T_STRING,
141 'title' => ts('Currency Numeric Code'),
142 'description' => ts('Numeric currency code'),
143 'maxlength' => 3,
144 'size' => CRM_Utils_Type::FOUR,
145 'import' => TRUE,
146 'where' => 'civicrm_currency.numeric_code',
147 'export' => TRUE,
148 'table_name' => 'civicrm_currency',
149 'entity' => 'Currency',
150 'bao' => 'CRM_Financial_DAO_Currency',
151 'localizable' => 0,
152 'add' => '1.9',
153 ],
154 'full_name' => [
155 'name' => 'full_name',
156 'type' => CRM_Utils_Type::T_STRING,
157 'title' => ts('Full Currency Name'),
158 'description' => ts('Full currency name'),
159 'maxlength' => 64,
160 'size' => CRM_Utils_Type::BIG,
161 'where' => 'civicrm_currency.full_name',
162 'table_name' => 'civicrm_currency',
163 'entity' => 'Currency',
164 'bao' => 'CRM_Financial_DAO_Currency',
165 'localizable' => 0,
166 'html' => [
167 'type' => 'Text',
168 ],
169 'add' => '1.9',
170 ],
171 ];
172 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
173 }
174 return Civi::$statics[__CLASS__]['fields'];
175 }
176
177 /**
178 * Return a mapping from field-name to the corresponding key (as used in fields()).
179 *
180 * @return array
181 * Array(string $name => string $uniqueName).
182 */
183 public static function &fieldKeys() {
184 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
185 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
186 }
187 return Civi::$statics[__CLASS__]['fieldKeys'];
188 }
189
190 /**
191 * Returns the names of this table
192 *
193 * @return string
194 */
195 public static function getTableName() {
196 return self::$_tableName;
197 }
198
199 /**
200 * Returns if this table needs to be logged
201 *
202 * @return bool
203 */
204 public function getLog() {
205 return self::$_log;
206 }
207
208 /**
209 * Returns the list of fields that can be imported
210 *
211 * @param bool $prefix
212 *
213 * @return array
214 */
215 public static function &import($prefix = FALSE) {
216 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'currency', $prefix, []);
217 return $r;
218 }
219
220 /**
221 * Returns the list of fields that can be exported
222 *
223 * @param bool $prefix
224 *
225 * @return array
226 */
227 public static function &export($prefix = FALSE) {
228 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'currency', $prefix, []);
229 return $r;
230 }
231
232 /**
233 * Returns the list of indices
234 *
235 * @param bool $localize
236 *
237 * @return array
238 */
239 public static function indices($localize = TRUE) {
240 $indices = [];
241 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
242 }
243
244 }