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