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