API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Core / DAO / Timezone.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/Timezone.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:fc76675346aa5a97d5ce798b9968ee58)
10 */
11
12 /**
13 * Database access object for the Timezone entity.
14 */
15 class CRM_Core_DAO_Timezone extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_timezone';
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 = FALSE;
30
31 /**
32 * Timezone Id
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Timezone full name
40 *
41 * @var string
42 */
43 public $name;
44
45 /**
46 * ISO Code for timezone abbreviation
47 *
48 * @var string
49 */
50 public $abbreviation;
51
52 /**
53 * GMT name of the timezone
54 *
55 * @var string
56 */
57 public $gmt;
58
59 /**
60 * @var int
61 */
62 public $offset;
63
64 /**
65 * Country Id
66 *
67 * @var int
68 */
69 public $country_id;
70
71 /**
72 * Class constructor.
73 */
74 public function __construct() {
75 $this->__table = 'civicrm_timezone';
76 parent::__construct();
77 }
78
79 /**
80 * Returns localized title of this entity.
81 */
82 public static function getEntityTitle() {
83 return ts('Timezones');
84 }
85
86 /**
87 * Returns foreign keys and entity references.
88 *
89 * @return array
90 * [CRM_Core_Reference_Interface]
91 */
92 public static function getReferenceColumns() {
93 if (!isset(Civi::$statics[__CLASS__]['links'])) {
94 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
95 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'country_id', 'civicrm_country', 'id');
96 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
97 }
98 return Civi::$statics[__CLASS__]['links'];
99 }
100
101 /**
102 * Returns all the column names of this table
103 *
104 * @return array
105 */
106 public static function &fields() {
107 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
108 Civi::$statics[__CLASS__]['fields'] = [
109 'id' => [
110 'name' => 'id',
111 'type' => CRM_Utils_Type::T_INT,
112 'title' => ts('Timezone ID'),
113 'description' => ts('Timezone Id'),
114 'required' => TRUE,
115 'where' => 'civicrm_timezone.id',
116 'table_name' => 'civicrm_timezone',
117 'entity' => 'Timezone',
118 'bao' => 'CRM_Core_DAO_Timezone',
119 'localizable' => 0,
120 'add' => '1.8',
121 ],
122 'name' => [
123 'name' => 'name',
124 'type' => CRM_Utils_Type::T_STRING,
125 'title' => ts('Timezone Name'),
126 'description' => ts('Timezone full name'),
127 'maxlength' => 64,
128 'size' => CRM_Utils_Type::BIG,
129 'where' => 'civicrm_timezone.name',
130 'table_name' => 'civicrm_timezone',
131 'entity' => 'Timezone',
132 'bao' => 'CRM_Core_DAO_Timezone',
133 'localizable' => 0,
134 'add' => '1.8',
135 ],
136 'abbreviation' => [
137 'name' => 'abbreviation',
138 'type' => CRM_Utils_Type::T_STRING,
139 'title' => ts('Timezone Abbreviation'),
140 'description' => ts('ISO Code for timezone abbreviation'),
141 'maxlength' => 3,
142 'size' => CRM_Utils_Type::FOUR,
143 'where' => 'civicrm_timezone.abbreviation',
144 'table_name' => 'civicrm_timezone',
145 'entity' => 'Timezone',
146 'bao' => 'CRM_Core_DAO_Timezone',
147 'localizable' => 0,
148 'add' => '1.8',
149 ],
150 'gmt' => [
151 'name' => 'gmt',
152 'type' => CRM_Utils_Type::T_STRING,
153 'title' => ts('GMT Name of Timezone'),
154 'description' => ts('GMT name of the timezone'),
155 'maxlength' => 64,
156 'size' => CRM_Utils_Type::BIG,
157 'where' => 'civicrm_timezone.gmt',
158 'table_name' => 'civicrm_timezone',
159 'entity' => 'Timezone',
160 'bao' => 'CRM_Core_DAO_Timezone',
161 'localizable' => 0,
162 'add' => '1.8',
163 ],
164 'offset' => [
165 'name' => 'offset',
166 'type' => CRM_Utils_Type::T_INT,
167 'title' => ts('GMT Offset'),
168 'where' => 'civicrm_timezone.offset',
169 'table_name' => 'civicrm_timezone',
170 'entity' => 'Timezone',
171 'bao' => 'CRM_Core_DAO_Timezone',
172 'localizable' => 0,
173 'add' => '1.8',
174 ],
175 'country_id' => [
176 'name' => 'country_id',
177 'type' => CRM_Utils_Type::T_INT,
178 'title' => ts('Country'),
179 'description' => ts('Country Id'),
180 'required' => TRUE,
181 'where' => 'civicrm_timezone.country_id',
182 'table_name' => 'civicrm_timezone',
183 'entity' => 'Timezone',
184 'bao' => 'CRM_Core_DAO_Timezone',
185 'localizable' => 0,
186 'FKClassName' => 'CRM_Core_DAO_Country',
187 'add' => '1.8',
188 ],
189 ];
190 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
191 }
192 return Civi::$statics[__CLASS__]['fields'];
193 }
194
195 /**
196 * Return a mapping from field-name to the corresponding key (as used in fields()).
197 *
198 * @return array
199 * Array(string $name => string $uniqueName).
200 */
201 public static function &fieldKeys() {
202 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
203 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
204 }
205 return Civi::$statics[__CLASS__]['fieldKeys'];
206 }
207
208 /**
209 * Returns the names of this table
210 *
211 * @return string
212 */
213 public static function getTableName() {
214 return self::$_tableName;
215 }
216
217 /**
218 * Returns if this table needs to be logged
219 *
220 * @return bool
221 */
222 public function getLog() {
223 return self::$_log;
224 }
225
226 /**
227 * Returns the list of fields that can be imported
228 *
229 * @param bool $prefix
230 *
231 * @return array
232 */
233 public static function &import($prefix = FALSE) {
234 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'timezone', $prefix, []);
235 return $r;
236 }
237
238 /**
239 * Returns the list of fields that can be exported
240 *
241 * @param bool $prefix
242 *
243 * @return array
244 */
245 public static function &export($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'timezone', $prefix, []);
247 return $r;
248 }
249
250 /**
251 * Returns the list of indices
252 *
253 * @param bool $localize
254 *
255 * @return array
256 */
257 public static function indices($localize = TRUE) {
258 $indices = [];
259 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
260 }
261
262 }