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