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