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