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