Merge pull request #14266 from seamuslee001/dev_core_369
[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 'where' => 'civicrm_currency.id',
89 'table_name' => 'civicrm_currency',
90 'entity' => 'Currency',
91 'bao' => 'CRM_Financial_DAO_Currency',
92 'localizable' => 0,
93 ],
94 'name' => [
95 'name' => 'name',
96 'type' => CRM_Utils_Type::T_STRING,
97 'title' => ts('Currency'),
98 'description' => ts('Currency Name'),
99 'maxlength' => 64,
100 'size' => CRM_Utils_Type::BIG,
101 'import' => TRUE,
102 'where' => 'civicrm_currency.name',
103 'export' => TRUE,
104 'table_name' => 'civicrm_currency',
105 'entity' => 'Currency',
106 'bao' => 'CRM_Financial_DAO_Currency',
107 'localizable' => 0,
108 'html' => [
109 'type' => 'Text',
110 ],
111 ],
112 'symbol' => [
113 'name' => 'symbol',
114 'type' => CRM_Utils_Type::T_STRING,
115 'title' => ts('Currency Symbol'),
116 'description' => ts('Currency Symbol'),
117 'maxlength' => 8,
118 'size' => CRM_Utils_Type::EIGHT,
119 'where' => 'civicrm_currency.symbol',
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 'export' => TRUE,
138 'table_name' => 'civicrm_currency',
139 'entity' => 'Currency',
140 'bao' => 'CRM_Financial_DAO_Currency',
141 'localizable' => 0,
142 ],
143 'full_name' => [
144 'name' => 'full_name',
145 'type' => CRM_Utils_Type::T_STRING,
146 'title' => ts('Full Currency Name'),
147 'description' => ts('Full currency name'),
148 'maxlength' => 64,
149 'size' => CRM_Utils_Type::BIG,
150 'where' => 'civicrm_currency.full_name',
151 'table_name' => 'civicrm_currency',
152 'entity' => 'Currency',
153 'bao' => 'CRM_Financial_DAO_Currency',
154 'localizable' => 0,
155 'html' => [
156 'type' => 'Text',
157 ],
158 ],
159 ];
160 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
161 }
162 return Civi::$statics[__CLASS__]['fields'];
163 }
164
165 /**
166 * Return a mapping from field-name to the corresponding key (as used in fields()).
167 *
168 * @return array
169 * Array(string $name => string $uniqueName).
170 */
171 public static function &fieldKeys() {
172 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
173 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
174 }
175 return Civi::$statics[__CLASS__]['fieldKeys'];
176 }
177
178 /**
179 * Returns the names of this table
180 *
181 * @return string
182 */
183 public static function getTableName() {
184 return self::$_tableName;
185 }
186
187 /**
188 * Returns if this table needs to be logged
189 *
190 * @return bool
191 */
192 public function getLog() {
193 return self::$_log;
194 }
195
196 /**
197 * Returns the list of fields that can be imported
198 *
199 * @param bool $prefix
200 *
201 * @return array
202 */
203 public static function &import($prefix = FALSE) {
204 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'currency', $prefix, []);
205 return $r;
206 }
207
208 /**
209 * Returns the list of fields that can be exported
210 *
211 * @param bool $prefix
212 *
213 * @return array
214 */
215 public static function &export($prefix = FALSE) {
216 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'currency', $prefix, []);
217 return $r;
218 }
219
220 /**
221 * Returns the list of indices
222 *
223 * @param bool $localize
224 *
225 * @return array
226 */
227 public static function indices($localize = TRUE) {
228 $indices = [];
229 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
230 }
231
232 }