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