Merge pull request #18193 from civicrm/5.29
[civicrm-core.git] / CRM / Core / DAO / PrevNextCache.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/PrevNextCache.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:8086ffe55554b0fba698136fd6dee894)
10 */
11
12 /**
13 * Database access object for the PrevNextCache entity.
14 */
15 class CRM_Core_DAO_PrevNextCache extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.4';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_prevnext_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 * @var int
35 */
36 public $id;
37
38 /**
39 * physical tablename for entity being joined to discount, e.g. civicrm_event
40 *
41 * @var string
42 */
43 public $entity_table;
44
45 /**
46 * FK to entity table specified in entity_table column.
47 *
48 * @var int
49 */
50 public $entity_id1;
51
52 /**
53 * FK to entity table specified in entity_table column.
54 *
55 * @var int
56 */
57 public $entity_id2;
58
59 /**
60 * Unique path name for cache element of the searched item
61 *
62 * @var string
63 */
64 public $cachekey;
65
66 /**
67 * cached snapshot of the serialized data
68 *
69 * @var longtext
70 */
71 public $data;
72
73 /**
74 * @var bool
75 */
76 public $is_selected;
77
78 /**
79 * Class constructor.
80 */
81 public function __construct() {
82 $this->__table = 'civicrm_prevnext_cache';
83 parent::__construct();
84 }
85
86 /**
87 * Returns localized title of this entity.
88 */
89 public static function getEntityTitle() {
90 return ts('Prev Next Caches');
91 }
92
93 /**
94 * Returns all the column names of this table
95 *
96 * @return array
97 */
98 public static function &fields() {
99 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
100 Civi::$statics[__CLASS__]['fields'] = [
101 'id' => [
102 'name' => 'id',
103 'type' => CRM_Utils_Type::T_INT,
104 'title' => ts('Prev Next Cache ID'),
105 'required' => TRUE,
106 'where' => 'civicrm_prevnext_cache.id',
107 'table_name' => 'civicrm_prevnext_cache',
108 'entity' => 'PrevNextCache',
109 'bao' => 'CRM_Core_BAO_PrevNextCache',
110 'localizable' => 0,
111 'add' => '3.4',
112 ],
113 'entity_table' => [
114 'name' => 'entity_table',
115 'type' => CRM_Utils_Type::T_STRING,
116 'title' => ts('Prev Next Entity Table'),
117 'description' => ts('physical tablename for entity being joined to discount, e.g. civicrm_event'),
118 'maxlength' => 64,
119 'size' => CRM_Utils_Type::BIG,
120 'where' => 'civicrm_prevnext_cache.entity_table',
121 'table_name' => 'civicrm_prevnext_cache',
122 'entity' => 'PrevNextCache',
123 'bao' => 'CRM_Core_BAO_PrevNextCache',
124 'localizable' => 0,
125 'add' => '3.4',
126 ],
127 'entity_id1' => [
128 'name' => 'entity_id1',
129 'type' => CRM_Utils_Type::T_INT,
130 'title' => ts('Prev Next Entity ID 1'),
131 'description' => ts('FK to entity table specified in entity_table column.'),
132 'required' => TRUE,
133 'where' => 'civicrm_prevnext_cache.entity_id1',
134 'table_name' => 'civicrm_prevnext_cache',
135 'entity' => 'PrevNextCache',
136 'bao' => 'CRM_Core_BAO_PrevNextCache',
137 'localizable' => 0,
138 'add' => '3.4',
139 ],
140 'entity_id2' => [
141 'name' => 'entity_id2',
142 'type' => CRM_Utils_Type::T_INT,
143 'title' => ts('Prev Next Entity ID 2'),
144 'description' => ts('FK to entity table specified in entity_table column.'),
145 'required' => FALSE,
146 'where' => 'civicrm_prevnext_cache.entity_id2',
147 'table_name' => 'civicrm_prevnext_cache',
148 'entity' => 'PrevNextCache',
149 'bao' => 'CRM_Core_BAO_PrevNextCache',
150 'localizable' => 0,
151 'add' => '3.4',
152 ],
153 'cachekey' => [
154 'name' => 'cachekey',
155 'type' => CRM_Utils_Type::T_STRING,
156 'title' => ts('Cache Key'),
157 'description' => ts('Unique path name for cache element of the searched item'),
158 'maxlength' => 255,
159 'size' => CRM_Utils_Type::HUGE,
160 'where' => 'civicrm_prevnext_cache.cachekey',
161 'table_name' => 'civicrm_prevnext_cache',
162 'entity' => 'PrevNextCache',
163 'bao' => 'CRM_Core_BAO_PrevNextCache',
164 'localizable' => 0,
165 'add' => '3.4',
166 ],
167 'data' => [
168 'name' => 'data',
169 'type' => CRM_Utils_Type::T_LONGTEXT,
170 'title' => ts('Prev Next Data'),
171 'description' => ts('cached snapshot of the serialized data'),
172 'where' => 'civicrm_prevnext_cache.data',
173 'table_name' => 'civicrm_prevnext_cache',
174 'entity' => 'PrevNextCache',
175 'bao' => 'CRM_Core_BAO_PrevNextCache',
176 'localizable' => 0,
177 'serialize' => self::SERIALIZE_PHP,
178 'add' => '3.4',
179 ],
180 'is_selected' => [
181 'name' => 'is_selected',
182 'type' => CRM_Utils_Type::T_BOOLEAN,
183 'title' => ts('Is Selected'),
184 'where' => 'civicrm_prevnext_cache.is_selected',
185 'default' => '0',
186 'table_name' => 'civicrm_prevnext_cache',
187 'entity' => 'PrevNextCache',
188 'bao' => 'CRM_Core_BAO_PrevNextCache',
189 'localizable' => 0,
190 'add' => '4.2',
191 ],
192 ];
193 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
194 }
195 return Civi::$statics[__CLASS__]['fields'];
196 }
197
198 /**
199 * Return a mapping from field-name to the corresponding key (as used in fields()).
200 *
201 * @return array
202 * Array(string $name => string $uniqueName).
203 */
204 public static function &fieldKeys() {
205 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
206 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
207 }
208 return Civi::$statics[__CLASS__]['fieldKeys'];
209 }
210
211 /**
212 * Returns the names of this table
213 *
214 * @return string
215 */
216 public static function getTableName() {
217 return self::$_tableName;
218 }
219
220 /**
221 * Returns if this table needs to be logged
222 *
223 * @return bool
224 */
225 public function getLog() {
226 return self::$_log;
227 }
228
229 /**
230 * Returns the list of fields that can be imported
231 *
232 * @param bool $prefix
233 *
234 * @return array
235 */
236 public static function &import($prefix = FALSE) {
237 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'prevnext_cache', $prefix, []);
238 return $r;
239 }
240
241 /**
242 * Returns the list of fields that can be exported
243 *
244 * @param bool $prefix
245 *
246 * @return array
247 */
248 public static function &export($prefix = FALSE) {
249 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'prevnext_cache', $prefix, []);
250 return $r;
251 }
252
253 /**
254 * Returns the list of indices
255 *
256 * @param bool $localize
257 *
258 * @return array
259 */
260 public static function indices($localize = TRUE) {
261 $indices = [
262 'index_all' => [
263 'name' => 'index_all',
264 'field' => [
265 0 => 'cachekey',
266 1 => 'entity_id1',
267 2 => 'entity_id2',
268 3 => 'entity_table',
269 4 => 'is_selected',
270 ],
271 'localizable' => FALSE,
272 'sig' => 'civicrm_prevnext_cache::0::cachekey::entity_id1::entity_id2::entity_table::is_selected',
273 ],
274 ];
275 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
276 }
277
278 }