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