3b75fab08927f403d9a357447adce432d15847f4
[civicrm-core.git] / CRM / Core / DAO / Timezone.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/Timezone.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e54363ef08090c4dfbed076c842edd03)
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 unsigned
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 unsigned
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 'table_name' => 'civicrm_timezone',
109 'entity' => 'Timezone',
110 'bao' => 'CRM_Core_DAO_Timezone',
111 'localizable' => 0,
112 ],
113 'name' => [
114 'name' => 'name',
115 'type' => CRM_Utils_Type::T_STRING,
116 'title' => ts('Timezone Name'),
117 'description' => ts('Timezone full name'),
118 'maxlength' => 64,
119 'size' => CRM_Utils_Type::BIG,
120 'table_name' => 'civicrm_timezone',
121 'entity' => 'Timezone',
122 'bao' => 'CRM_Core_DAO_Timezone',
123 'localizable' => 0,
124 ],
125 'abbreviation' => [
126 'name' => 'abbreviation',
127 'type' => CRM_Utils_Type::T_STRING,
128 'title' => ts('Timezone Abbreviation'),
129 'description' => ts('ISO Code for timezone abbreviation'),
130 'maxlength' => 3,
131 'size' => CRM_Utils_Type::FOUR,
132 'table_name' => 'civicrm_timezone',
133 'entity' => 'Timezone',
134 'bao' => 'CRM_Core_DAO_Timezone',
135 'localizable' => 0,
136 ],
137 'gmt' => [
138 'name' => 'gmt',
139 'type' => CRM_Utils_Type::T_STRING,
140 'title' => ts('GMT Name of Timezone'),
141 'description' => ts('GMT name of the timezone'),
142 'maxlength' => 64,
143 'size' => CRM_Utils_Type::BIG,
144 'table_name' => 'civicrm_timezone',
145 'entity' => 'Timezone',
146 'bao' => 'CRM_Core_DAO_Timezone',
147 'localizable' => 0,
148 ],
149 'offset' => [
150 'name' => 'offset',
151 'type' => CRM_Utils_Type::T_INT,
152 'title' => ts('GMT Offset'),
153 'table_name' => 'civicrm_timezone',
154 'entity' => 'Timezone',
155 'bao' => 'CRM_Core_DAO_Timezone',
156 'localizable' => 0,
157 ],
158 'country_id' => [
159 'name' => 'country_id',
160 'type' => CRM_Utils_Type::T_INT,
161 'title' => ts('Country'),
162 'description' => ts('Country Id'),
163 'required' => TRUE,
164 'table_name' => 'civicrm_timezone',
165 'entity' => 'Timezone',
166 'bao' => 'CRM_Core_DAO_Timezone',
167 'localizable' => 0,
168 'FKClassName' => 'CRM_Core_DAO_Country',
169 ],
170 ];
171 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
172 }
173 return Civi::$statics[__CLASS__]['fields'];
174 }
175
176 /**
177 * Return a mapping from field-name to the corresponding key (as used in fields()).
178 *
179 * @return array
180 * Array(string $name => string $uniqueName).
181 */
182 public static function &fieldKeys() {
183 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
184 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
185 }
186 return Civi::$statics[__CLASS__]['fieldKeys'];
187 }
188
189 /**
190 * Returns the names of this table
191 *
192 * @return string
193 */
194 public static function getTableName() {
195 return self::$_tableName;
196 }
197
198 /**
199 * Returns if this table needs to be logged
200 *
201 * @return bool
202 */
203 public function getLog() {
204 return self::$_log;
205 }
206
207 /**
208 * Returns the list of fields that can be imported
209 *
210 * @param bool $prefix
211 *
212 * @return array
213 */
214 public static function &import($prefix = FALSE) {
215 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'timezone', $prefix, []);
216 return $r;
217 }
218
219 /**
220 * Returns the list of fields that can be exported
221 *
222 * @param bool $prefix
223 *
224 * @return array
225 */
226 public static function &export($prefix = FALSE) {
227 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'timezone', $prefix, []);
228 return $r;
229 }
230
231 /**
232 * Returns the list of indices
233 *
234 * @param bool $localize
235 *
236 * @return array
237 */
238 public static function indices($localize = TRUE) {
239 $indices = [];
240 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
241 }
242
243 }