Merge pull request #17720 from alifrumin/5.27.0-releasenotes
[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:a48a49afa56a0c510fb1c05a41a62435)
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 foreign keys and entity references.
81 *
82 * @return array
83 * [CRM_Core_Reference_Interface]
84 */
85 public static function getReferenceColumns() {
86 if (!isset(Civi::$statics[__CLASS__]['links'])) {
87 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
88 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'country_id', 'civicrm_country', 'id');
89 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
90 }
91 return Civi::$statics[__CLASS__]['links'];
92 }
93
94 /**
95 * Returns all the column names of this table
96 *
97 * @return array
98 */
99 public static function &fields() {
100 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
101 Civi::$statics[__CLASS__]['fields'] = [
102 'id' => [
103 'name' => 'id',
104 'type' => CRM_Utils_Type::T_INT,
105 'title' => ts('Timezone ID'),
106 'description' => ts('Timezone Id'),
107 'required' => TRUE,
108 'where' => 'civicrm_timezone.id',
109 'table_name' => 'civicrm_timezone',
110 'entity' => 'Timezone',
111 'bao' => 'CRM_Core_DAO_Timezone',
112 'localizable' => 0,
113 ],
114 'name' => [
115 'name' => 'name',
116 'type' => CRM_Utils_Type::T_STRING,
117 'title' => ts('Timezone Name'),
118 'description' => ts('Timezone full name'),
119 'maxlength' => 64,
120 'size' => CRM_Utils_Type::BIG,
121 'where' => 'civicrm_timezone.name',
122 'table_name' => 'civicrm_timezone',
123 'entity' => 'Timezone',
124 'bao' => 'CRM_Core_DAO_Timezone',
125 'localizable' => 0,
126 ],
127 'abbreviation' => [
128 'name' => 'abbreviation',
129 'type' => CRM_Utils_Type::T_STRING,
130 'title' => ts('Timezone Abbreviation'),
131 'description' => ts('ISO Code for timezone abbreviation'),
132 'maxlength' => 3,
133 'size' => CRM_Utils_Type::FOUR,
134 'where' => 'civicrm_timezone.abbreviation',
135 'table_name' => 'civicrm_timezone',
136 'entity' => 'Timezone',
137 'bao' => 'CRM_Core_DAO_Timezone',
138 'localizable' => 0,
139 ],
140 'gmt' => [
141 'name' => 'gmt',
142 'type' => CRM_Utils_Type::T_STRING,
143 'title' => ts('GMT Name of Timezone'),
144 'description' => ts('GMT name of the timezone'),
145 'maxlength' => 64,
146 'size' => CRM_Utils_Type::BIG,
147 'where' => 'civicrm_timezone.gmt',
148 'table_name' => 'civicrm_timezone',
149 'entity' => 'Timezone',
150 'bao' => 'CRM_Core_DAO_Timezone',
151 'localizable' => 0,
152 ],
153 'offset' => [
154 'name' => 'offset',
155 'type' => CRM_Utils_Type::T_INT,
156 'title' => ts('GMT Offset'),
157 'where' => 'civicrm_timezone.offset',
158 'table_name' => 'civicrm_timezone',
159 'entity' => 'Timezone',
160 'bao' => 'CRM_Core_DAO_Timezone',
161 'localizable' => 0,
162 ],
163 'country_id' => [
164 'name' => 'country_id',
165 'type' => CRM_Utils_Type::T_INT,
166 'title' => ts('Country'),
167 'description' => ts('Country Id'),
168 'required' => TRUE,
169 'where' => 'civicrm_timezone.country_id',
170 'table_name' => 'civicrm_timezone',
171 'entity' => 'Timezone',
172 'bao' => 'CRM_Core_DAO_Timezone',
173 'localizable' => 0,
174 'FKClassName' => 'CRM_Core_DAO_Country',
175 ],
176 ];
177 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
178 }
179 return Civi::$statics[__CLASS__]['fields'];
180 }
181
182 /**
183 * Return a mapping from field-name to the corresponding key (as used in fields()).
184 *
185 * @return array
186 * Array(string $name => string $uniqueName).
187 */
188 public static function &fieldKeys() {
189 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
190 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
191 }
192 return Civi::$statics[__CLASS__]['fieldKeys'];
193 }
194
195 /**
196 * Returns the names of this table
197 *
198 * @return string
199 */
200 public static function getTableName() {
201 return self::$_tableName;
202 }
203
204 /**
205 * Returns if this table needs to be logged
206 *
207 * @return bool
208 */
209 public function getLog() {
210 return self::$_log;
211 }
212
213 /**
214 * Returns the list of fields that can be imported
215 *
216 * @param bool $prefix
217 *
218 * @return array
219 */
220 public static function &import($prefix = FALSE) {
221 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'timezone', $prefix, []);
222 return $r;
223 }
224
225 /**
226 * Returns the list of fields that can be exported
227 *
228 * @param bool $prefix
229 *
230 * @return array
231 */
232 public static function &export($prefix = FALSE) {
233 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'timezone', $prefix, []);
234 return $r;
235 }
236
237 /**
238 * Returns the list of indices
239 *
240 * @param bool $localize
241 *
242 * @return array
243 */
244 public static function indices($localize = TRUE) {
245 $indices = [];
246 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
247 }
248
249 }