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