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