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