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