Add "labelField" metadata to entities
[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:a9172e230dd513e6a06f5fec2e0ddb90)
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 'add' => '1.7',
107 ],
108 'name' => [
109 'name' => 'name',
110 'type' => CRM_Utils_Type::T_STRING,
111 'title' => ts('Currency'),
112 'description' => ts('Currency Name'),
113 'maxlength' => 64,
114 'size' => CRM_Utils_Type::BIG,
115 'import' => TRUE,
116 'where' => 'civicrm_currency.name',
117 'export' => TRUE,
118 'table_name' => 'civicrm_currency',
119 'entity' => 'Currency',
120 'bao' => 'CRM_Financial_DAO_Currency',
121 'localizable' => 0,
122 'html' => [
123 'type' => 'Text',
124 ],
125 'add' => '1.7',
126 ],
127 'symbol' => [
128 'name' => 'symbol',
129 'type' => CRM_Utils_Type::T_STRING,
130 'title' => ts('Currency Symbol'),
131 'description' => ts('Currency Symbol'),
132 'maxlength' => 8,
133 'size' => CRM_Utils_Type::EIGHT,
134 'where' => 'civicrm_currency.symbol',
135 'table_name' => 'civicrm_currency',
136 'entity' => 'Currency',
137 'bao' => 'CRM_Financial_DAO_Currency',
138 'localizable' => 0,
139 'html' => [
140 'type' => 'Text',
141 ],
142 'add' => '1.7',
143 ],
144 'numeric_code' => [
145 'name' => 'numeric_code',
146 'type' => CRM_Utils_Type::T_STRING,
147 'title' => ts('Currency Numeric Code'),
148 'description' => ts('Numeric currency code'),
149 'maxlength' => 3,
150 'size' => CRM_Utils_Type::FOUR,
151 'import' => TRUE,
152 'where' => 'civicrm_currency.numeric_code',
153 'export' => TRUE,
154 'table_name' => 'civicrm_currency',
155 'entity' => 'Currency',
156 'bao' => 'CRM_Financial_DAO_Currency',
157 'localizable' => 0,
158 'add' => '1.9',
159 ],
160 'full_name' => [
161 'name' => 'full_name',
162 'type' => CRM_Utils_Type::T_STRING,
163 'title' => ts('Full Currency Name'),
164 'description' => ts('Full currency name'),
165 'maxlength' => 64,
166 'size' => CRM_Utils_Type::BIG,
167 'where' => 'civicrm_currency.full_name',
168 'table_name' => 'civicrm_currency',
169 'entity' => 'Currency',
170 'bao' => 'CRM_Financial_DAO_Currency',
171 'localizable' => 0,
172 'html' => [
173 'type' => 'Text',
174 ],
175 'add' => '1.9',
176 ],
177 ];
178 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
179 }
180 return Civi::$statics[__CLASS__]['fields'];
181 }
182
183 /**
184 * Return a mapping from field-name to the corresponding key (as used in fields()).
185 *
186 * @return array
187 * Array(string $name => string $uniqueName).
188 */
189 public static function &fieldKeys() {
190 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
191 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
192 }
193 return Civi::$statics[__CLASS__]['fieldKeys'];
194 }
195
196 /**
197 * Returns the names of this table
198 *
199 * @return string
200 */
201 public static function getTableName() {
202 return self::$_tableName;
203 }
204
205 /**
206 * Returns if this table needs to be logged
207 *
208 * @return bool
209 */
210 public function getLog() {
211 return self::$_log;
212 }
213
214 /**
215 * Returns the list of fields that can be imported
216 *
217 * @param bool $prefix
218 *
219 * @return array
220 */
221 public static function &import($prefix = FALSE) {
222 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'currency', $prefix, []);
223 return $r;
224 }
225
226 /**
227 * Returns the list of fields that can be exported
228 *
229 * @param bool $prefix
230 *
231 * @return array
232 */
233 public static function &export($prefix = FALSE) {
234 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'currency', $prefix, []);
235 return $r;
236 }
237
238 /**
239 * Returns the list of indices
240 *
241 * @param bool $localize
242 *
243 * @return array
244 */
245 public static function indices($localize = TRUE) {
246 $indices = [];
247 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
248 }
249
250 }