xml/templates/dao.tpl - Simplify fieldKeys()
[civicrm-core.git] / CRM / Core / DAO / Cache.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Core/Cache.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:b145d7f1474d493c2df518be572bc56c)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_Cache extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_cache';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
e501603b
TO
62 /**
63 * static value to see if we should log any modifications to
64 * this table in the civicrm_log table
65 *
66 * @var boolean
67 */
68 static $_log = false;
69 /**
70 *
71 * @var int unsigned
72 */
73 public $id;
74 /**
75 * group name for cache element, useful in cleaning cache elements
76 *
77 * @var string
78 */
79 public $group_name;
80 /**
81 * Unique path name for cache element
82 *
83 * @var string
84 */
85 public $path;
86 /**
87 * data associated with this path
88 *
89 * @var longtext
90 */
91 public $data;
92 /**
93 * Component that this menu item belongs to
94 *
95 * @var int unsigned
96 */
97 public $component_id;
98 /**
99 * When was the cache item created
100 *
101 * @var datetime
102 */
103 public $created_date;
104 /**
105 * When should the cache item expire
106 *
107 * @var datetime
108 */
109 public $expired_date;
110 /**
111 * class constructor
112 *
113 * @return civicrm_cache
114 */
115 function __construct() {
116 $this->__table = 'civicrm_cache';
117 parent::__construct();
118 }
119 /**
120 * Returns foreign keys and entity references
121 *
122 * @return array
123 * [CRM_Core_Reference_Interface]
124 */
125 static function getReferenceColumns() {
126 if (!self::$_links) {
127 self::$_links = static ::createReferenceColumns(__CLASS__);
128 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id');
129 }
130 return self::$_links;
131 }
132 /**
133 * Returns all the column names of this table
134 *
135 * @return array
136 */
137 static function &fields() {
138 if (!(self::$_fields)) {
139 self::$_fields = array(
140 'id' => array(
141 'name' => 'id',
142 'type' => CRM_Utils_Type::T_INT,
143 'required' => true,
144 ) ,
145 'group_name' => array(
146 'name' => 'group_name',
147 'type' => CRM_Utils_Type::T_STRING,
148 'title' => ts('Group Name') ,
149 'description' => 'group name for cache element, useful in cleaning cache elements',
150 'required' => true,
151 'maxlength' => 32,
152 'size' => CRM_Utils_Type::MEDIUM,
153 ) ,
154 'path' => array(
155 'name' => 'path',
156 'type' => CRM_Utils_Type::T_STRING,
157 'title' => ts('Path') ,
158 'description' => 'Unique path name for cache element',
159 'maxlength' => 255,
160 'size' => CRM_Utils_Type::HUGE,
161 ) ,
162 'data' => array(
163 'name' => 'data',
164 'type' => CRM_Utils_Type::T_LONGTEXT,
165 'title' => ts('Data') ,
166 'description' => 'data associated with this path',
167 ) ,
168 'component_id' => array(
169 'name' => 'component_id',
170 'type' => CRM_Utils_Type::T_INT,
171 'description' => 'Component that this menu item belongs to',
172 'FKClassName' => 'CRM_Core_DAO_Component',
173 'html' => array(
174 'type' => 'Select',
175 ) ,
176 'pseudoconstant' => array(
177 'table' => 'civicrm_component',
178 'keyColumn' => 'id',
179 'labelColumn' => 'name',
180 )
181 ) ,
182 'created_date' => array(
183 'name' => 'created_date',
184 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
185 'title' => ts('Created Date') ,
186 'description' => 'When was the cache item created',
187 ) ,
188 'expired_date' => array(
189 'name' => 'expired_date',
190 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
191 'title' => ts('Expired Date') ,
192 'description' => 'When should the cache item expire',
193 ) ,
194 );
195 }
196 return self::$_fields;
197 }
198 /**
199 * Returns an array containing, for each field, the arary key used for that
200 * field in self::$_fields.
201 *
202 * @return array
203 */
204 static function &fieldKeys() {
205 if (!(self::$_fieldKeys)) {
206 self::$_fieldKeys = array(
207 'id' => 'id',
208 'group_name' => 'group_name',
209 'path' => 'path',
210 'data' => 'data',
211 'component_id' => 'component_id',
212 'created_date' => 'created_date',
213 'expired_date' => 'expired_date',
214 );
215 }
216 return self::$_fieldKeys;
217 }
218 /**
219 * Returns the names of this table
220 *
221 * @return string
222 */
223 static function getTableName() {
224 return self::$_tableName;
225 }
226 /**
227 * Returns if this table needs to be logged
228 *
229 * @return boolean
230 */
231 function getLog() {
232 return self::$_log;
233 }
234 /**
235 * Returns the list of fields that can be imported
236 *
237 * @param bool $prefix
238 *
239 * @return array
240 */
241 static function &import($prefix = false) {
60808919
TO
242 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cache', $prefix, array());
243 return $r;
e501603b
TO
244 }
245 /**
246 * Returns the list of fields that can be exported
247 *
248 * @param bool $prefix
249 *
250 * @return array
251 */
252 static function &export($prefix = false) {
60808919
TO
253 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cache', $prefix, array());
254 return $r;
e501603b
TO
255 }
256}