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