Merge pull request #23419 from chrisgaraffa/contactheader-regions
[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:bb3ae6e3a2a974f5a7e121a7ba763af6)
10 */
11
12 /**
13 * Database access object for the Timezone entity.
14 */
15 class CRM_Core_DAO_Timezone extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.8';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_timezone';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * Timezone ID
35 *
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
39 */
40 public $id;
41
42 /**
43 * Timezone full name
44 *
45 * @var string|null
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
48 */
49 public $name;
50
51 /**
52 * ISO Code for timezone abbreviation
53 *
54 * @var string|null
55 * (SQL type: char(3))
56 * Note that values will be retrieved from the database as a string.
57 */
58 public $abbreviation;
59
60 /**
61 * GMT name of the timezone
62 *
63 * @var string|null
64 * (SQL type: varchar(64))
65 * Note that values will be retrieved from the database as a string.
66 */
67 public $gmt;
68
69 /**
70 * @var int|string|null
71 * (SQL type: int)
72 * Note that values will be retrieved from the database as a string.
73 */
74 public $offset;
75
76 /**
77 * Country ID
78 *
79 * @var int|string
80 * (SQL type: int unsigned)
81 * Note that values will be retrieved from the database as a string.
82 */
83 public $country_id;
84
85 /**
86 * Class constructor.
87 */
88 public function __construct() {
89 $this->__table = 'civicrm_timezone';
90 parent::__construct();
91 }
92
93 /**
94 * Returns localized title of this entity.
95 *
96 * @param bool $plural
97 * Whether to return the plural version of the title.
98 */
99 public static function getEntityTitle($plural = FALSE) {
100 return $plural ? ts('Timezones') : ts('Timezone');
101 }
102
103 /**
104 * Returns foreign keys and entity references.
105 *
106 * @return array
107 * [CRM_Core_Reference_Interface]
108 */
109 public static function getReferenceColumns() {
110 if (!isset(Civi::$statics[__CLASS__]['links'])) {
111 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
112 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'country_id', 'civicrm_country', 'id');
113 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
114 }
115 return Civi::$statics[__CLASS__]['links'];
116 }
117
118 /**
119 * Returns all the column names of this table
120 *
121 * @return array
122 */
123 public static function &fields() {
124 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
125 Civi::$statics[__CLASS__]['fields'] = [
126 'id' => [
127 'name' => 'id',
128 'type' => CRM_Utils_Type::T_INT,
129 'title' => ts('Timezone ID'),
130 'description' => ts('Timezone ID'),
131 'required' => TRUE,
132 'where' => 'civicrm_timezone.id',
133 'table_name' => 'civicrm_timezone',
134 'entity' => 'Timezone',
135 'bao' => 'CRM_Core_DAO_Timezone',
136 'localizable' => 0,
137 'html' => [
138 'type' => 'Number',
139 ],
140 'readonly' => TRUE,
141 'add' => '1.8',
142 ],
143 'name' => [
144 'name' => 'name',
145 'type' => CRM_Utils_Type::T_STRING,
146 'title' => ts('Timezone Name'),
147 'description' => ts('Timezone full name'),
148 'maxlength' => 64,
149 'size' => CRM_Utils_Type::BIG,
150 'where' => 'civicrm_timezone.name',
151 'table_name' => 'civicrm_timezone',
152 'entity' => 'Timezone',
153 'bao' => 'CRM_Core_DAO_Timezone',
154 'localizable' => 0,
155 'add' => '1.8',
156 ],
157 'abbreviation' => [
158 'name' => 'abbreviation',
159 'type' => CRM_Utils_Type::T_STRING,
160 'title' => ts('Timezone Abbreviation'),
161 'description' => ts('ISO Code for timezone abbreviation'),
162 'maxlength' => 3,
163 'size' => CRM_Utils_Type::FOUR,
164 'where' => 'civicrm_timezone.abbreviation',
165 'table_name' => 'civicrm_timezone',
166 'entity' => 'Timezone',
167 'bao' => 'CRM_Core_DAO_Timezone',
168 'localizable' => 0,
169 'add' => '1.8',
170 ],
171 'gmt' => [
172 'name' => 'gmt',
173 'type' => CRM_Utils_Type::T_STRING,
174 'title' => ts('GMT Name of Timezone'),
175 'description' => ts('GMT name of the timezone'),
176 'maxlength' => 64,
177 'size' => CRM_Utils_Type::BIG,
178 'where' => 'civicrm_timezone.gmt',
179 'table_name' => 'civicrm_timezone',
180 'entity' => 'Timezone',
181 'bao' => 'CRM_Core_DAO_Timezone',
182 'localizable' => 0,
183 'add' => '1.8',
184 ],
185 'offset' => [
186 'name' => 'offset',
187 'type' => CRM_Utils_Type::T_INT,
188 'title' => ts('GMT Offset'),
189 'where' => 'civicrm_timezone.offset',
190 'table_name' => 'civicrm_timezone',
191 'entity' => 'Timezone',
192 'bao' => 'CRM_Core_DAO_Timezone',
193 'localizable' => 0,
194 'add' => '1.8',
195 ],
196 'country_id' => [
197 'name' => 'country_id',
198 'type' => CRM_Utils_Type::T_INT,
199 'title' => ts('Country ID'),
200 'description' => ts('Country ID'),
201 'required' => TRUE,
202 'where' => 'civicrm_timezone.country_id',
203 'table_name' => 'civicrm_timezone',
204 'entity' => 'Timezone',
205 'bao' => 'CRM_Core_DAO_Timezone',
206 'localizable' => 0,
207 'FKClassName' => 'CRM_Core_DAO_Country',
208 'html' => [
209 'label' => ts("Country"),
210 ],
211 'add' => '1.8',
212 ],
213 ];
214 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
215 }
216 return Civi::$statics[__CLASS__]['fields'];
217 }
218
219 /**
220 * Return a mapping from field-name to the corresponding key (as used in fields()).
221 *
222 * @return array
223 * Array(string $name => string $uniqueName).
224 */
225 public static function &fieldKeys() {
226 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
227 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
228 }
229 return Civi::$statics[__CLASS__]['fieldKeys'];
230 }
231
232 /**
233 * Returns the names of this table
234 *
235 * @return string
236 */
237 public static function getTableName() {
238 return self::$_tableName;
239 }
240
241 /**
242 * Returns if this table needs to be logged
243 *
244 * @return bool
245 */
246 public function getLog() {
247 return self::$_log;
248 }
249
250 /**
251 * Returns the list of fields that can be imported
252 *
253 * @param bool $prefix
254 *
255 * @return array
256 */
257 public static function &import($prefix = FALSE) {
258 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'timezone', $prefix, []);
259 return $r;
260 }
261
262 /**
263 * Returns the list of fields that can be exported
264 *
265 * @param bool $prefix
266 *
267 * @return array
268 */
269 public static function &export($prefix = FALSE) {
270 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'timezone', $prefix, []);
271 return $r;
272 }
273
274 /**
275 * Returns the list of indices
276 *
277 * @param bool $localize
278 *
279 * @return array
280 */
281 public static function indices($localize = TRUE) {
282 $indices = [];
283 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
284 }
285
286 }