Annotate DAO files with COMPONENT, exclude disabled components' entities from APIv4...
[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
d31fb4e3 9 * (GenCodeChecksum:a0d91310a76fe98662806ef3104d8f30)
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,
a9d0587b 116 'add' => '2.0',
c3fc2621
CW
117 ],
118 'name' => [
e501603b
TO
119 'name' => 'name',
120 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 121 'title' => ts('Date Preference Name'),
215b423e 122 'description' => ts('The meta name for this date (fixed in code)'),
c3fc2621 123 'required' => TRUE,
e501603b
TO
124 'maxlength' => 64,
125 'size' => CRM_Utils_Type::BIG,
a36434b9 126 'where' => 'civicrm_preferences_date.name',
522a26c9 127 'table_name' => 'civicrm_preferences_date',
128 'entity' => 'PreferencesDate',
129 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 130 'localizable' => 0,
a9d0587b 131 'add' => '2.0',
c3fc2621
CW
132 ],
133 'description' => [
e501603b
TO
134 'name' => 'description',
135 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 136 'title' => ts('Description'),
215b423e 137 'description' => ts('Description of this date type.'),
e501603b
TO
138 'maxlength' => 255,
139 'size' => CRM_Utils_Type::HUGE,
a36434b9 140 'where' => 'civicrm_preferences_date.description',
522a26c9 141 'table_name' => 'civicrm_preferences_date',
142 'entity' => 'PreferencesDate',
143 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 144 'localizable' => 0,
a9d0587b 145 'add' => '2.0',
c3fc2621
CW
146 ],
147 'start' => [
e501603b
TO
148 'name' => 'start',
149 'type' => CRM_Utils_Type::T_INT,
c3fc2621 150 'title' => ts('Start'),
215b423e 151 'description' => ts('The start offset relative to current year'),
c3fc2621 152 'required' => TRUE,
a36434b9 153 'where' => 'civicrm_preferences_date.start',
522a26c9 154 'table_name' => 'civicrm_preferences_date',
155 'entity' => 'PreferencesDate',
156 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 157 'localizable' => 0,
a9d0587b 158 'add' => '2.0',
c3fc2621
CW
159 ],
160 'end' => [
e501603b
TO
161 'name' => 'end',
162 'type' => CRM_Utils_Type::T_INT,
c3fc2621 163 'title' => ts('End Offset'),
215b423e 164 'description' => ts('The end offset relative to current year, can be negative'),
c3fc2621 165 'required' => TRUE,
a36434b9 166 'where' => 'civicrm_preferences_date.end',
522a26c9 167 'table_name' => 'civicrm_preferences_date',
168 'entity' => 'PreferencesDate',
169 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 170 'localizable' => 0,
a9d0587b 171 'add' => '2.0',
c3fc2621
CW
172 ],
173 'date_format' => [
e501603b
TO
174 'name' => 'date_format',
175 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 176 'title' => ts('Date Format'),
215b423e 177 'description' => ts('The date type'),
e501603b
TO
178 'maxlength' => 64,
179 'size' => CRM_Utils_Type::BIG,
a36434b9 180 'where' => 'civicrm_preferences_date.date_format',
522a26c9 181 'table_name' => 'civicrm_preferences_date',
182 'entity' => 'PreferencesDate',
183 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 184 'localizable' => 0,
a9d0587b 185 'add' => '2.0',
c3fc2621
CW
186 ],
187 'time_format' => [
e501603b
TO
188 'name' => 'time_format',
189 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 190 'title' => ts('Time Format'),
215b423e 191 'description' => ts('time format'),
e501603b
TO
192 'maxlength' => 64,
193 'size' => CRM_Utils_Type::BIG,
a36434b9 194 'where' => 'civicrm_preferences_date.time_format',
522a26c9 195 'table_name' => 'civicrm_preferences_date',
196 'entity' => 'PreferencesDate',
197 'bao' => 'CRM_Core_BAO_PreferencesDate',
6a7e5e5d 198 'localizable' => 0,
a9d0587b 199 'add' => '3.1',
c3fc2621
CW
200 ],
201 ];
346aaaba 202 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 203 }
346aaaba 204 return Civi::$statics[__CLASS__]['fields'];
e501603b 205 }
c3fc2621 206
e501603b 207 /**
bd8e0b14 208 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
209 *
210 * @return array
bd8e0b14 211 * Array(string $name => string $uniqueName).
e501603b 212 */
c3fc2621 213 public static function &fieldKeys() {
bd8e0b14
TO
214 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
215 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 216 }
bd8e0b14 217 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 218 }
c3fc2621 219
e501603b
TO
220 /**
221 * Returns the names of this table
222 *
223 * @return string
224 */
c3fc2621 225 public static function getTableName() {
e501603b
TO
226 return self::$_tableName;
227 }
c3fc2621 228
e501603b
TO
229 /**
230 * Returns if this table needs to be logged
231 *
c3fc2621 232 * @return bool
e501603b 233 */
c3fc2621 234 public function getLog() {
e501603b
TO
235 return self::$_log;
236 }
c3fc2621 237
e501603b
TO
238 /**
239 * Returns the list of fields that can be imported
240 *
241 * @param bool $prefix
242 *
243 * @return array
244 */
c3fc2621
CW
245 public static function &import($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'preferences_date', $prefix, []);
60808919 247 return $r;
e501603b 248 }
c3fc2621 249
e501603b
TO
250 /**
251 * Returns the list of fields that can be exported
252 *
253 * @param bool $prefix
254 *
255 * @return array
256 */
c3fc2621
CW
257 public static function &export($prefix = FALSE) {
258 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'preferences_date', $prefix, []);
60808919 259 return $r;
e501603b 260 }
c3fc2621 261
e7a6b91a
AS
262 /**
263 * Returns the list of indices
c3fc2621
CW
264 *
265 * @param bool $localize
266 *
267 * @return array
e7a6b91a
AS
268 */
269 public static function indices($localize = TRUE) {
c3fc2621
CW
270 $indices = [
271 'index_name' => [
e7a6b91a 272 'name' => 'index_name',
c3fc2621 273 'field' => [
e7a6b91a 274 0 => 'name',
c3fc2621
CW
275 ],
276 'localizable' => FALSE,
e7a6b91a 277 'sig' => 'civicrm_preferences_date::0::name',
c3fc2621
CW
278 ],
279 ];
e7a6b91a
AS
280 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
281 }
c3fc2621 282
e501603b 283}