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