Commit | Line | Data |
---|---|---|
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/Cache.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
a9d0587b | 9 | * (GenCodeChecksum:695d7ebea0e7103ff58dfbbff111dde6) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Cache entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_Cache 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_cache'; |
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 = FALSE; |
c3fc2621 | 30 | |
e501603b | 31 | /** |
6692f42b PN |
32 | * Unique table ID |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * group name for cache element, useful in cleaning cache elements | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | public $group_name; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Unique path name for cache element | |
47 | * | |
48 | * @var string | |
49 | */ | |
50 | public $path; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * data associated with this path | |
54 | * | |
55 | * @var longtext | |
56 | */ | |
57 | public $data; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Component that this menu item belongs to | |
61 | * | |
e6ca0a57 | 62 | * @var int |
e501603b TO |
63 | */ |
64 | public $component_id; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * When was the cache item created | |
68 | * | |
6c2b97b7 | 69 | * @var timestamp |
e501603b TO |
70 | */ |
71 | public $created_date; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * When should the cache item expire | |
75 | * | |
6c2b97b7 | 76 | * @var timestamp |
e501603b TO |
77 | */ |
78 | public $expired_date; | |
c3fc2621 | 79 | |
e501603b | 80 | /** |
f41f0342 | 81 | * Class constructor. |
e501603b | 82 | */ |
c3fc2621 | 83 | public function __construct() { |
e501603b TO |
84 | $this->__table = 'civicrm_cache'; |
85 | parent::__construct(); | |
86 | } | |
c3fc2621 | 87 | |
449c4e6b CW |
88 | /** |
89 | * Returns localized title of this entity. | |
90 | */ | |
91 | public static function getEntityTitle() { | |
92 | return ts('Caches'); | |
93 | } | |
94 | ||
e501603b | 95 | /** |
f41f0342 | 96 | * Returns foreign keys and entity references. |
e501603b TO |
97 | * |
98 | * @return array | |
99 | * [CRM_Core_Reference_Interface] | |
100 | */ | |
c3fc2621 | 101 | public static function getReferenceColumns() { |
346aaaba | 102 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 103 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 104 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'component_id', 'civicrm_component', 'id'); |
346aaaba | 105 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 106 | } |
346aaaba | 107 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 108 | } |
c3fc2621 | 109 | |
e501603b TO |
110 | /** |
111 | * Returns all the column names of this table | |
112 | * | |
113 | * @return array | |
114 | */ | |
c3fc2621 | 115 | public static function &fields() { |
346aaaba | 116 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
117 | Civi::$statics[__CLASS__]['fields'] = [ |
118 | 'id' => [ | |
e501603b TO |
119 | 'name' => 'id', |
120 | 'type' => CRM_Utils_Type::T_INT, | |
6692f42b PN |
121 | 'title' => ts('Cache ID'), |
122 | 'description' => ts('Unique table ID'), | |
c3fc2621 | 123 | 'required' => TRUE, |
a36434b9 | 124 | 'where' => 'civicrm_cache.id', |
522a26c9 | 125 | 'table_name' => 'civicrm_cache', |
126 | 'entity' => 'Cache', | |
127 | 'bao' => 'CRM_Core_BAO_Cache', | |
6a7e5e5d | 128 | 'localizable' => 0, |
a9d0587b | 129 | 'add' => '2.1', |
c3fc2621 CW |
130 | ], |
131 | 'group_name' => [ | |
e501603b TO |
132 | 'name' => 'group_name', |
133 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 134 | 'title' => ts('Group Name'), |
215b423e | 135 | 'description' => ts('group name for cache element, useful in cleaning cache elements'), |
c3fc2621 | 136 | 'required' => TRUE, |
e501603b TO |
137 | 'maxlength' => 32, |
138 | 'size' => CRM_Utils_Type::MEDIUM, | |
a36434b9 | 139 | 'where' => 'civicrm_cache.group_name', |
522a26c9 | 140 | 'table_name' => 'civicrm_cache', |
141 | 'entity' => 'Cache', | |
142 | 'bao' => 'CRM_Core_BAO_Cache', | |
6a7e5e5d | 143 | 'localizable' => 0, |
a9d0587b | 144 | 'add' => '2.1', |
c3fc2621 CW |
145 | ], |
146 | 'path' => [ | |
e501603b TO |
147 | 'name' => 'path', |
148 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 149 | 'title' => ts('Path'), |
215b423e | 150 | 'description' => ts('Unique path name for cache element'), |
e501603b TO |
151 | 'maxlength' => 255, |
152 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 153 | 'where' => 'civicrm_cache.path', |
522a26c9 | 154 | 'table_name' => 'civicrm_cache', |
155 | 'entity' => 'Cache', | |
156 | 'bao' => 'CRM_Core_BAO_Cache', | |
6a7e5e5d | 157 | 'localizable' => 0, |
a9d0587b | 158 | 'add' => '2.1', |
c3fc2621 CW |
159 | ], |
160 | 'data' => [ | |
e501603b TO |
161 | 'name' => 'data', |
162 | 'type' => CRM_Utils_Type::T_LONGTEXT, | |
c3fc2621 | 163 | 'title' => ts('Data'), |
215b423e | 164 | 'description' => ts('data associated with this path'), |
a36434b9 | 165 | 'where' => 'civicrm_cache.data', |
522a26c9 | 166 | 'table_name' => 'civicrm_cache', |
167 | 'entity' => 'Cache', | |
168 | 'bao' => 'CRM_Core_BAO_Cache', | |
6a7e5e5d | 169 | 'localizable' => 0, |
a9d0587b | 170 | 'add' => '2.1', |
c3fc2621 CW |
171 | ], |
172 | 'component_id' => [ | |
e501603b TO |
173 | 'name' => 'component_id', |
174 | 'type' => CRM_Utils_Type::T_INT, | |
6692f42b | 175 | 'title' => ts('Component ID'), |
215b423e | 176 | 'description' => ts('Component that this menu item belongs to'), |
a36434b9 | 177 | 'where' => 'civicrm_cache.component_id', |
522a26c9 | 178 | 'table_name' => 'civicrm_cache', |
179 | 'entity' => 'Cache', | |
180 | 'bao' => 'CRM_Core_BAO_Cache', | |
6a7e5e5d | 181 | 'localizable' => 0, |
e501603b | 182 | 'FKClassName' => 'CRM_Core_DAO_Component', |
c3fc2621 | 183 | 'html' => [ |
e501603b | 184 | 'type' => 'Select', |
c3fc2621 CW |
185 | ], |
186 | 'pseudoconstant' => [ | |
e501603b TO |
187 | 'table' => 'civicrm_component', |
188 | 'keyColumn' => 'id', | |
189 | 'labelColumn' => 'name', | |
e6ca0a57 | 190 | ], |
a9d0587b | 191 | 'add' => '2.1', |
c3fc2621 CW |
192 | ], |
193 | 'created_date' => [ | |
e501603b | 194 | 'name' => 'created_date', |
6c2b97b7 | 195 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
c3fc2621 | 196 | 'title' => ts('Created Date'), |
215b423e | 197 | 'description' => ts('When was the cache item created'), |
a36434b9 | 198 | 'where' => 'civicrm_cache.created_date', |
6c2b97b7 | 199 | 'default' => 'CURRENT_TIMESTAMP', |
522a26c9 | 200 | 'table_name' => 'civicrm_cache', |
201 | 'entity' => 'Cache', | |
202 | 'bao' => 'CRM_Core_BAO_Cache', | |
6a7e5e5d | 203 | 'localizable' => 0, |
a9d0587b | 204 | 'add' => '2.1', |
c3fc2621 CW |
205 | ], |
206 | 'expired_date' => [ | |
e501603b | 207 | 'name' => 'expired_date', |
6c2b97b7 | 208 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
c3fc2621 | 209 | 'title' => ts('Expired Date'), |
215b423e | 210 | 'description' => ts('When should the cache item expire'), |
c3fc2621 | 211 | 'required' => FALSE, |
a36434b9 | 212 | 'where' => 'civicrm_cache.expired_date', |
6c2b97b7 | 213 | 'default' => 'NULL', |
522a26c9 | 214 | 'table_name' => 'civicrm_cache', |
215 | 'entity' => 'Cache', | |
216 | 'bao' => 'CRM_Core_BAO_Cache', | |
6a7e5e5d | 217 | 'localizable' => 0, |
a9d0587b | 218 | 'add' => '2.1', |
c3fc2621 CW |
219 | ], |
220 | ]; | |
346aaaba | 221 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 222 | } |
346aaaba | 223 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 224 | } |
c3fc2621 | 225 | |
e501603b | 226 | /** |
bd8e0b14 | 227 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
228 | * |
229 | * @return array | |
bd8e0b14 | 230 | * Array(string $name => string $uniqueName). |
e501603b | 231 | */ |
c3fc2621 | 232 | public static function &fieldKeys() { |
bd8e0b14 TO |
233 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
234 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 235 | } |
bd8e0b14 | 236 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 237 | } |
c3fc2621 | 238 | |
e501603b TO |
239 | /** |
240 | * Returns the names of this table | |
241 | * | |
242 | * @return string | |
243 | */ | |
c3fc2621 | 244 | public static function getTableName() { |
e501603b TO |
245 | return self::$_tableName; |
246 | } | |
c3fc2621 | 247 | |
e501603b TO |
248 | /** |
249 | * Returns if this table needs to be logged | |
250 | * | |
c3fc2621 | 251 | * @return bool |
e501603b | 252 | */ |
c3fc2621 | 253 | public function getLog() { |
e501603b TO |
254 | return self::$_log; |
255 | } | |
c3fc2621 | 256 | |
e501603b TO |
257 | /** |
258 | * Returns the list of fields that can be imported | |
259 | * | |
260 | * @param bool $prefix | |
261 | * | |
262 | * @return array | |
263 | */ | |
c3fc2621 CW |
264 | public static function &import($prefix = FALSE) { |
265 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cache', $prefix, []); | |
60808919 | 266 | return $r; |
e501603b | 267 | } |
c3fc2621 | 268 | |
e501603b TO |
269 | /** |
270 | * Returns the list of fields that can be exported | |
271 | * | |
272 | * @param bool $prefix | |
273 | * | |
274 | * @return array | |
275 | */ | |
c3fc2621 CW |
276 | public static function &export($prefix = FALSE) { |
277 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cache', $prefix, []); | |
60808919 | 278 | return $r; |
e501603b | 279 | } |
c3fc2621 | 280 | |
e7a6b91a AS |
281 | /** |
282 | * Returns the list of indices | |
c3fc2621 CW |
283 | * |
284 | * @param bool $localize | |
285 | * | |
286 | * @return array | |
e7a6b91a AS |
287 | */ |
288 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
289 | $indices = [ |
290 | 'UI_group_path_date' => [ | |
e7a6b91a | 291 | 'name' => 'UI_group_path_date', |
c3fc2621 | 292 | 'field' => [ |
e7a6b91a AS |
293 | 0 => 'group_name', |
294 | 1 => 'path', | |
295 | 2 => 'created_date', | |
c3fc2621 CW |
296 | ], |
297 | 'localizable' => FALSE, | |
298 | 'unique' => TRUE, | |
e7a6b91a | 299 | 'sig' => 'civicrm_cache::1::group_name::path::created_date', |
c3fc2621 CW |
300 | ], |
301 | ]; | |
e7a6b91a AS |
302 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
303 | } | |
c3fc2621 | 304 | |
e501603b | 305 | } |