Merge pull request #17640 from samuelsov/bugreportcivigrant
[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:0c8797659c05f81eb6f2f2589b5baee4)
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 ],
121 'name' => [
122 'name' => 'name',
123 'type' => CRM_Utils_Type::T_STRING,
124 'title' => ts('Timezone Name'),
125 'description' => ts('Timezone full name'),
126 'maxlength' => 64,
127 'size' => CRM_Utils_Type::BIG,
128 'where' => 'civicrm_timezone.name',
129 'table_name' => 'civicrm_timezone',
130 'entity' => 'Timezone',
131 'bao' => 'CRM_Core_DAO_Timezone',
132 'localizable' => 0,
133 ],
134 'abbreviation' => [
135 'name' => 'abbreviation',
136 'type' => CRM_Utils_Type::T_STRING,
137 'title' => ts('Timezone Abbreviation'),
138 'description' => ts('ISO Code for timezone abbreviation'),
139 'maxlength' => 3,
140 'size' => CRM_Utils_Type::FOUR,
141 'where' => 'civicrm_timezone.abbreviation',
142 'table_name' => 'civicrm_timezone',
143 'entity' => 'Timezone',
144 'bao' => 'CRM_Core_DAO_Timezone',
145 'localizable' => 0,
146 ],
147 'gmt' => [
148 'name' => 'gmt',
149 'type' => CRM_Utils_Type::T_STRING,
150 'title' => ts('GMT Name of Timezone'),
151 'description' => ts('GMT name of the timezone'),
152 'maxlength' => 64,
153 'size' => CRM_Utils_Type::BIG,
154 'where' => 'civicrm_timezone.gmt',
155 'table_name' => 'civicrm_timezone',
156 'entity' => 'Timezone',
157 'bao' => 'CRM_Core_DAO_Timezone',
158 'localizable' => 0,
159 ],
160 'offset' => [
161 'name' => 'offset',
162 'type' => CRM_Utils_Type::T_INT,
163 'title' => ts('GMT Offset'),
164 'where' => 'civicrm_timezone.offset',
165 'table_name' => 'civicrm_timezone',
166 'entity' => 'Timezone',
167 'bao' => 'CRM_Core_DAO_Timezone',
168 'localizable' => 0,
169 ],
170 'country_id' => [
171 'name' => 'country_id',
172 'type' => CRM_Utils_Type::T_INT,
173 'title' => ts('Country'),
174 'description' => ts('Country Id'),
175 'required' => TRUE,
176 'where' => 'civicrm_timezone.country_id',
177 'table_name' => 'civicrm_timezone',
178 'entity' => 'Timezone',
179 'bao' => 'CRM_Core_DAO_Timezone',
180 'localizable' => 0,
181 'FKClassName' => 'CRM_Core_DAO_Country',
182 ],
183 ];
184 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
185 }
186 return Civi::$statics[__CLASS__]['fields'];
187 }
188
189 /**
190 * Return a mapping from field-name to the corresponding key (as used in fields()).
191 *
192 * @return array
193 * Array(string $name => string $uniqueName).
194 */
195 public static function &fieldKeys() {
196 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
197 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
198 }
199 return Civi::$statics[__CLASS__]['fieldKeys'];
200 }
201
202 /**
203 * Returns the names of this table
204 *
205 * @return string
206 */
207 public static function getTableName() {
208 return self::$_tableName;
209 }
210
211 /**
212 * Returns if this table needs to be logged
213 *
214 * @return bool
215 */
216 public function getLog() {
217 return self::$_log;
218 }
219
220 /**
221 * Returns the list of fields that can be imported
222 *
223 * @param bool $prefix
224 *
225 * @return array
226 */
227 public static function &import($prefix = FALSE) {
228 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'timezone', $prefix, []);
229 return $r;
230 }
231
232 /**
233 * Returns the list of fields that can be exported
234 *
235 * @param bool $prefix
236 *
237 * @return array
238 */
239 public static function &export($prefix = FALSE) {
240 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'timezone', $prefix, []);
241 return $r;
242 }
243
244 /**
245 * Returns the list of indices
246 *
247 * @param bool $localize
248 *
249 * @return array
250 */
251 public static function indices($localize = TRUE) {
252 $indices = [];
253 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
254 }
255
256 }