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