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