Merge pull request #13986 from seamuslee001/coder_upgrade_uf_tag_sms
[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:0683b150dd60e1ec9b53c00957137a27)
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 'table_name' => 'civicrm_cache',
114 'entity' => 'Cache',
115 'bao' => 'CRM_Core_BAO_Cache',
116 'localizable' => 0,
117 ],
118 'group_name' => [
119 'name' => 'group_name',
120 'type' => CRM_Utils_Type::T_STRING,
121 'title' => ts('Group Name'),
122 'description' => ts('group name for cache element, useful in cleaning cache elements'),
123 'required' => TRUE,
124 'maxlength' => 32,
125 'size' => CRM_Utils_Type::MEDIUM,
126 'table_name' => 'civicrm_cache',
127 'entity' => 'Cache',
128 'bao' => 'CRM_Core_BAO_Cache',
129 'localizable' => 0,
130 ],
131 'path' => [
132 'name' => 'path',
133 'type' => CRM_Utils_Type::T_STRING,
134 'title' => ts('Path'),
135 'description' => ts('Unique path name for cache element'),
136 'maxlength' => 255,
137 'size' => CRM_Utils_Type::HUGE,
138 'table_name' => 'civicrm_cache',
139 'entity' => 'Cache',
140 'bao' => 'CRM_Core_BAO_Cache',
141 'localizable' => 0,
142 ],
143 'data' => [
144 'name' => 'data',
145 'type' => CRM_Utils_Type::T_LONGTEXT,
146 'title' => ts('Data'),
147 'description' => ts('data associated with this path'),
148 'table_name' => 'civicrm_cache',
149 'entity' => 'Cache',
150 'bao' => 'CRM_Core_BAO_Cache',
151 'localizable' => 0,
152 ],
153 'component_id' => [
154 'name' => 'component_id',
155 'type' => CRM_Utils_Type::T_INT,
156 'description' => ts('Component that this menu item belongs to'),
157 'table_name' => 'civicrm_cache',
158 'entity' => 'Cache',
159 'bao' => 'CRM_Core_BAO_Cache',
160 'localizable' => 0,
161 'FKClassName' => 'CRM_Core_DAO_Component',
162 'html' => [
163 'type' => 'Select',
164 ],
165 'pseudoconstant' => [
166 'table' => 'civicrm_component',
167 'keyColumn' => 'id',
168 'labelColumn' => 'name',
169 ]
170 ],
171 'created_date' => [
172 'name' => 'created_date',
173 'type' => CRM_Utils_Type::T_TIMESTAMP,
174 'title' => ts('Created Date'),
175 'description' => ts('When was the cache item created'),
176 'default' => 'CURRENT_TIMESTAMP',
177 'table_name' => 'civicrm_cache',
178 'entity' => 'Cache',
179 'bao' => 'CRM_Core_BAO_Cache',
180 'localizable' => 0,
181 ],
182 'expired_date' => [
183 'name' => 'expired_date',
184 'type' => CRM_Utils_Type::T_TIMESTAMP,
185 'title' => ts('Expired Date'),
186 'description' => ts('When should the cache item expire'),
187 'required' => FALSE,
188 'default' => 'NULL',
189 'table_name' => 'civicrm_cache',
190 'entity' => 'Cache',
191 'bao' => 'CRM_Core_BAO_Cache',
192 'localizable' => 0,
193 ],
194 ];
195 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
196 }
197 return Civi::$statics[__CLASS__]['fields'];
198 }
199
200 /**
201 * Return a mapping from field-name to the corresponding key (as used in fields()).
202 *
203 * @return array
204 * Array(string $name => string $uniqueName).
205 */
206 public static function &fieldKeys() {
207 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
208 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
209 }
210 return Civi::$statics[__CLASS__]['fieldKeys'];
211 }
212
213 /**
214 * Returns the names of this table
215 *
216 * @return string
217 */
218 public static function getTableName() {
219 return self::$_tableName;
220 }
221
222 /**
223 * Returns if this table needs to be logged
224 *
225 * @return bool
226 */
227 public function getLog() {
228 return self::$_log;
229 }
230
231 /**
232 * Returns the list of fields that can be imported
233 *
234 * @param bool $prefix
235 *
236 * @return array
237 */
238 public static function &import($prefix = FALSE) {
239 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cache', $prefix, []);
240 return $r;
241 }
242
243 /**
244 * Returns the list of fields that can be exported
245 *
246 * @param bool $prefix
247 *
248 * @return array
249 */
250 public static function &export($prefix = FALSE) {
251 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cache', $prefix, []);
252 return $r;
253 }
254
255 /**
256 * Returns the list of indices
257 *
258 * @param bool $localize
259 *
260 * @return array
261 */
262 public static function indices($localize = TRUE) {
263 $indices = [
264 'UI_group_path_date' => [
265 'name' => 'UI_group_path_date',
266 'field' => [
267 0 => 'group_name',
268 1 => 'path',
269 2 => 'created_date',
270 ],
271 'localizable' => FALSE,
272 'unique' => TRUE,
273 'sig' => 'civicrm_cache::1::group_name::path::created_date',
274 ],
275 ];
276 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
277 }
278
279 }