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