Reformat DAO files to pass linting and use short array syntax
[civicrm-core.git] / CRM / Core / DAO / PreferencesDate.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2017
6 *
7 * Generated from xml/schema/CRM/Core/PreferencesDate.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:50b4071bc8734a772c01b450d22f5920)
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 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 static $_log = TRUE;
30
31 /**
32 * @var int unsigned
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 all the column names of this table
88 *
89 * @return array
90 */
91 public static function &fields() {
92 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
93 Civi::$statics[__CLASS__]['fields'] = [
94 'id' => [
95 'name' => 'id',
96 'type' => CRM_Utils_Type::T_INT,
97 'title' => ts('Date Preference ID'),
98 'required' => TRUE,
99 'table_name' => 'civicrm_preferences_date',
100 'entity' => 'PreferencesDate',
101 'bao' => 'CRM_Core_BAO_PreferencesDate',
102 'localizable' => 0,
103 ],
104 'name' => [
105 'name' => 'name',
106 'type' => CRM_Utils_Type::T_STRING,
107 'title' => ts('Date Preference Name'),
108 'description' => 'The meta name for this date (fixed in code)',
109 'required' => TRUE,
110 'maxlength' => 64,
111 'size' => CRM_Utils_Type::BIG,
112 'table_name' => 'civicrm_preferences_date',
113 'entity' => 'PreferencesDate',
114 'bao' => 'CRM_Core_BAO_PreferencesDate',
115 'localizable' => 0,
116 ],
117 'description' => [
118 'name' => 'description',
119 'type' => CRM_Utils_Type::T_STRING,
120 'title' => ts('Description'),
121 'description' => 'Description of this date type.',
122 'maxlength' => 255,
123 'size' => CRM_Utils_Type::HUGE,
124 'table_name' => 'civicrm_preferences_date',
125 'entity' => 'PreferencesDate',
126 'bao' => 'CRM_Core_BAO_PreferencesDate',
127 'localizable' => 0,
128 ],
129 'start' => [
130 'name' => 'start',
131 'type' => CRM_Utils_Type::T_INT,
132 'title' => ts('Start'),
133 'description' => 'The start offset relative to current year',
134 'required' => TRUE,
135 'table_name' => 'civicrm_preferences_date',
136 'entity' => 'PreferencesDate',
137 'bao' => 'CRM_Core_BAO_PreferencesDate',
138 'localizable' => 0,
139 ],
140 'end' => [
141 'name' => 'end',
142 'type' => CRM_Utils_Type::T_INT,
143 'title' => ts('End Offset'),
144 'description' => 'The end offset relative to current year, can be negative',
145 'required' => TRUE,
146 'table_name' => 'civicrm_preferences_date',
147 'entity' => 'PreferencesDate',
148 'bao' => 'CRM_Core_BAO_PreferencesDate',
149 'localizable' => 0,
150 ],
151 'date_format' => [
152 'name' => 'date_format',
153 'type' => CRM_Utils_Type::T_STRING,
154 'title' => ts('Date Format'),
155 'description' => 'The date type',
156 'maxlength' => 64,
157 'size' => CRM_Utils_Type::BIG,
158 'table_name' => 'civicrm_preferences_date',
159 'entity' => 'PreferencesDate',
160 'bao' => 'CRM_Core_BAO_PreferencesDate',
161 'localizable' => 0,
162 ],
163 'time_format' => [
164 'name' => 'time_format',
165 'type' => CRM_Utils_Type::T_STRING,
166 'title' => ts('Time Format'),
167 'description' => 'time format',
168 'maxlength' => 64,
169 'size' => CRM_Utils_Type::BIG,
170 'table_name' => 'civicrm_preferences_date',
171 'entity' => 'PreferencesDate',
172 'bao' => 'CRM_Core_BAO_PreferencesDate',
173 'localizable' => 0,
174 ],
175 ];
176 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
177 }
178 return Civi::$statics[__CLASS__]['fields'];
179 }
180
181 /**
182 * Return a mapping from field-name to the corresponding key (as used in fields()).
183 *
184 * @return array
185 * Array(string $name => string $uniqueName).
186 */
187 public static function &fieldKeys() {
188 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
189 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
190 }
191 return Civi::$statics[__CLASS__]['fieldKeys'];
192 }
193
194 /**
195 * Returns the names of this table
196 *
197 * @return string
198 */
199 public static function getTableName() {
200 return self::$_tableName;
201 }
202
203 /**
204 * Returns if this table needs to be logged
205 *
206 * @return bool
207 */
208 public function getLog() {
209 return self::$_log;
210 }
211
212 /**
213 * Returns the list of fields that can be imported
214 *
215 * @param bool $prefix
216 *
217 * @return array
218 */
219 public static function &import($prefix = FALSE) {
220 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'preferences_date', $prefix, []);
221 return $r;
222 }
223
224 /**
225 * Returns the list of fields that can be exported
226 *
227 * @param bool $prefix
228 *
229 * @return array
230 */
231 public static function &export($prefix = FALSE) {
232 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'preferences_date', $prefix, []);
233 return $r;
234 }
235
236 /**
237 * Returns the list of indices
238 *
239 * @param bool $localize
240 *
241 * @return array
242 */
243 public static function indices($localize = TRUE) {
244 $indices = [
245 'index_name' => [
246 'name' => 'index_name',
247 'field' => [
248 0 => 'name',
249 ],
250 'localizable' => FALSE,
251 'sig' => 'civicrm_preferences_date::0::name',
252 ],
253 ];
254 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
255 }
256
257 }