Merge pull request #22428 from civicrm/5.46
[civicrm-core.git] / CRM / Core / DAO / PreferencesDate.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/PreferencesDate.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:767dc30f83e4087a07c185f857fc8fb3)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the PreferencesDate entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_PreferencesDate extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.0';
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_preferences_date';
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 = TRUE;
c3fc2621 32
e501603b 33 /**
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * The meta name for this date (fixed in code)
40 *
41 * @var string
42 */
43 public $name;
c3fc2621 44
e501603b
TO
45 /**
46 * Description of this date type.
47 *
48 * @var string
49 */
50 public $description;
c3fc2621 51
e501603b
TO
52 /**
53 * The start offset relative to current year
54 *
55 * @var int
56 */
57 public $start;
c3fc2621 58
e501603b
TO
59 /**
60 * The end offset relative to current year, can be negative
61 *
62 * @var int
63 */
64 public $end;
c3fc2621 65
e501603b
TO
66 /**
67 * The date type
68 *
69 * @var string
70 */
71 public $date_format;
c3fc2621 72
e501603b
TO
73 /**
74 * time format
75 *
76 * @var string
77 */
78 public $time_format;
c3fc2621 79
e501603b 80 /**
f41f0342 81 * Class constructor.
e501603b 82 */
c3fc2621 83 public function __construct() {
e501603b
TO
84 $this->__table = 'civicrm_preferences_date';
85 parent::__construct();
86 }
c3fc2621 87
449c4e6b
CW
88 /**
89 * Returns localized title of this entity.
7b66c3b5
AH
90 *
91 * @param bool $plural
92 * Whether to return the plural version of the title.
449c4e6b 93 */
7b66c3b5
AH
94 public static function getEntityTitle($plural = FALSE) {
95 return $plural ? ts('Preferences Dates') : ts('Preferences Date');
449c4e6b
CW
96 }
97
e501603b
TO
98 /**
99 * Returns all the column names of this table
100 *
101 * @return array
102 */
c3fc2621 103 public static function &fields() {
346aaaba 104 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
105 Civi::$statics[__CLASS__]['fields'] = [
106 'id' => [
e501603b
TO
107 'name' => 'id',
108 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
109 'title' => ts('Date Preference ID'),
110 'required' => TRUE,
a36434b9 111 'where' => 'civicrm_preferences_date.id',
522a26c9 112 'table_name' => 'civicrm_preferences_date',
113 'entity' => 'PreferencesDate',
114 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 115 'localizable' => 0,
2cbbebe8
A
116 'html' => [
117 'type' => 'Number',
118 ],
1fe423d6 119 'readonly' => TRUE,
a9d0587b 120 'add' => '2.0',
c3fc2621
CW
121 ],
122 'name' => [
e501603b
TO
123 'name' => 'name',
124 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 125 'title' => ts('Date Preference Name'),
215b423e 126 'description' => ts('The meta name for this date (fixed in code)'),
c3fc2621 127 'required' => TRUE,
e501603b
TO
128 'maxlength' => 64,
129 'size' => CRM_Utils_Type::BIG,
a36434b9 130 'where' => 'civicrm_preferences_date.name',
522a26c9 131 'table_name' => 'civicrm_preferences_date',
132 'entity' => 'PreferencesDate',
133 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 134 'localizable' => 0,
a9d0587b 135 'add' => '2.0',
c3fc2621
CW
136 ],
137 'description' => [
e501603b
TO
138 'name' => 'description',
139 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 140 'title' => ts('Description'),
215b423e 141 'description' => ts('Description of this date type.'),
e501603b
TO
142 'maxlength' => 255,
143 'size' => CRM_Utils_Type::HUGE,
a36434b9 144 'where' => 'civicrm_preferences_date.description',
522a26c9 145 'table_name' => 'civicrm_preferences_date',
146 'entity' => 'PreferencesDate',
147 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 148 'localizable' => 0,
c23563e3
SL
149 'html' => [
150 'label' => ts("Description"),
151 ],
a9d0587b 152 'add' => '2.0',
c3fc2621
CW
153 ],
154 'start' => [
e501603b
TO
155 'name' => 'start',
156 'type' => CRM_Utils_Type::T_INT,
c3fc2621 157 'title' => ts('Start'),
215b423e 158 'description' => ts('The start offset relative to current year'),
c3fc2621 159 'required' => TRUE,
a36434b9 160 'where' => 'civicrm_preferences_date.start',
522a26c9 161 'table_name' => 'civicrm_preferences_date',
162 'entity' => 'PreferencesDate',
163 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 164 'localizable' => 0,
c23563e3
SL
165 'html' => [
166 'label' => ts("Start"),
167 ],
a9d0587b 168 'add' => '2.0',
c3fc2621
CW
169 ],
170 'end' => [
e501603b
TO
171 'name' => 'end',
172 'type' => CRM_Utils_Type::T_INT,
c3fc2621 173 'title' => ts('End Offset'),
215b423e 174 'description' => ts('The end offset relative to current year, can be negative'),
c3fc2621 175 'required' => TRUE,
a36434b9 176 'where' => 'civicrm_preferences_date.end',
522a26c9 177 'table_name' => 'civicrm_preferences_date',
178 'entity' => 'PreferencesDate',
179 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 180 'localizable' => 0,
a9d0587b 181 'add' => '2.0',
c3fc2621
CW
182 ],
183 'date_format' => [
e501603b
TO
184 'name' => 'date_format',
185 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 186 'title' => ts('Date Format'),
215b423e 187 'description' => ts('The date type'),
e501603b
TO
188 'maxlength' => 64,
189 'size' => CRM_Utils_Type::BIG,
a36434b9 190 'where' => 'civicrm_preferences_date.date_format',
522a26c9 191 'table_name' => 'civicrm_preferences_date',
192 'entity' => 'PreferencesDate',
193 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 194 'localizable' => 0,
c23563e3
SL
195 'html' => [
196 'label' => ts("Date Format"),
197 ],
a9d0587b 198 'add' => '2.0',
c3fc2621
CW
199 ],
200 'time_format' => [
e501603b
TO
201 'name' => 'time_format',
202 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 203 'title' => ts('Time Format'),
215b423e 204 'description' => ts('time format'),
e501603b
TO
205 'maxlength' => 64,
206 'size' => CRM_Utils_Type::BIG,
a36434b9 207 'where' => 'civicrm_preferences_date.time_format',
522a26c9 208 'table_name' => 'civicrm_preferences_date',
209 'entity' => 'PreferencesDate',
210 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 211 'localizable' => 0,
c23563e3
SL
212 'html' => [
213 'label' => ts("Time Format"),
214 ],
a9d0587b 215 'add' => '3.1',
c3fc2621
CW
216 ],
217 ];
346aaaba 218 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 219 }
346aaaba 220 return Civi::$statics[__CLASS__]['fields'];
e501603b 221 }
c3fc2621 222
e501603b 223 /**
bd8e0b14 224 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
225 *
226 * @return array
bd8e0b14 227 * Array(string $name => string $uniqueName).
e501603b 228 */
c3fc2621 229 public static function &fieldKeys() {
bd8e0b14
TO
230 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
231 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 232 }
bd8e0b14 233 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 234 }
c3fc2621 235
e501603b
TO
236 /**
237 * Returns the names of this table
238 *
239 * @return string
240 */
c3fc2621 241 public static function getTableName() {
e501603b
TO
242 return self::$_tableName;
243 }
c3fc2621 244
e501603b
TO
245 /**
246 * Returns if this table needs to be logged
247 *
c3fc2621 248 * @return bool
e501603b 249 */
c3fc2621 250 public function getLog() {
e501603b
TO
251 return self::$_log;
252 }
c3fc2621 253
e501603b
TO
254 /**
255 * Returns the list of fields that can be imported
256 *
257 * @param bool $prefix
258 *
259 * @return array
260 */
c3fc2621
CW
261 public static function &import($prefix = FALSE) {
262 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'preferences_date', $prefix, []);
60808919 263 return $r;
e501603b 264 }
c3fc2621 265
e501603b
TO
266 /**
267 * Returns the list of fields that can be exported
268 *
269 * @param bool $prefix
270 *
271 * @return array
272 */
c3fc2621
CW
273 public static function &export($prefix = FALSE) {
274 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'preferences_date', $prefix, []);
60808919 275 return $r;
e501603b 276 }
c3fc2621 277
e7a6b91a
AS
278 /**
279 * Returns the list of indices
c3fc2621
CW
280 *
281 * @param bool $localize
282 *
283 * @return array
e7a6b91a
AS
284 */
285 public static function indices($localize = TRUE) {
c3fc2621
CW
286 $indices = [
287 'index_name' => [
e7a6b91a 288 'name' => 'index_name',
c3fc2621 289 'field' => [
e7a6b91a 290 0 => 'name',
c3fc2621
CW
291 ],
292 'localizable' => FALSE,
e7a6b91a 293 'sig' => 'civicrm_preferences_date::0::name',
c3fc2621
CW
294 ],
295 ];
e7a6b91a
AS
296 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
297 }
c3fc2621 298
e501603b 299}