Merge pull request #22460 from civicrm/5.46
[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
2562d09a 9 * (GenCodeChecksum:af3cb54c291525d39547cefa9bddf11a)
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.
7b66c3b5
AH
88 *
89 * @param bool $plural
90 * Whether to return the plural version of the title.
449c4e6b 91 */
7b66c3b5
AH
92 public static function getEntityTitle($plural = FALSE) {
93 return $plural ? ts('Prev Next Caches') : ts('Prev Next Cache');
449c4e6b
CW
94 }
95
e501603b
TO
96 /**
97 * Returns all the column names of this table
98 *
99 * @return array
100 */
c3fc2621 101 public static function &fields() {
346aaaba 102 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
103 Civi::$statics[__CLASS__]['fields'] = [
104 'id' => [
e501603b
TO
105 'name' => 'id',
106 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
107 'title' => ts('Prev Next Cache ID'),
108 'required' => TRUE,
a36434b9 109 'where' => 'civicrm_prevnext_cache.id',
522a26c9 110 'table_name' => 'civicrm_prevnext_cache',
111 'entity' => 'PrevNextCache',
112 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 113 'localizable' => 0,
2cbbebe8
A
114 'html' => [
115 'type' => 'Number',
116 ],
1fe423d6 117 'readonly' => TRUE,
a9d0587b 118 'add' => '3.4',
c3fc2621
CW
119 ],
120 'entity_table' => [
e501603b
TO
121 'name' => 'entity_table',
122 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 123 'title' => ts('Prev Next Entity Table'),
215b423e 124 'description' => ts('physical tablename for entity being joined to discount, e.g. civicrm_event'),
e501603b
TO
125 'maxlength' => 64,
126 'size' => CRM_Utils_Type::BIG,
a36434b9 127 'where' => 'civicrm_prevnext_cache.entity_table',
522a26c9 128 'table_name' => 'civicrm_prevnext_cache',
129 'entity' => 'PrevNextCache',
130 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 131 'localizable' => 0,
a9d0587b 132 'add' => '3.4',
c3fc2621
CW
133 ],
134 'entity_id1' => [
e501603b
TO
135 'name' => 'entity_id1',
136 'type' => CRM_Utils_Type::T_INT,
c3fc2621 137 'title' => ts('Prev Next Entity ID 1'),
215b423e 138 'description' => ts('FK to entity table specified in entity_table column.'),
c3fc2621 139 'required' => TRUE,
a36434b9 140 'where' => 'civicrm_prevnext_cache.entity_id1',
522a26c9 141 'table_name' => 'civicrm_prevnext_cache',
142 'entity' => 'PrevNextCache',
143 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 144 'localizable' => 0,
a9d0587b 145 'add' => '3.4',
c3fc2621
CW
146 ],
147 'entity_id2' => [
e501603b
TO
148 'name' => 'entity_id2',
149 'type' => CRM_Utils_Type::T_INT,
c3fc2621 150 'title' => ts('Prev Next Entity ID 2'),
215b423e 151 'description' => ts('FK to entity table specified in entity_table column.'),
230a9938 152 'required' => FALSE,
a36434b9 153 'where' => 'civicrm_prevnext_cache.entity_id2',
522a26c9 154 'table_name' => 'civicrm_prevnext_cache',
155 'entity' => 'PrevNextCache',
156 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 157 'localizable' => 0,
a9d0587b 158 'add' => '3.4',
c3fc2621 159 ],
783b4b21
SL
160 'cachekey' => [
161 'name' => 'cachekey',
e501603b 162 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 163 'title' => ts('Cache Key'),
215b423e 164 'description' => ts('Unique path name for cache element of the searched item'),
e501603b
TO
165 'maxlength' => 255,
166 'size' => CRM_Utils_Type::HUGE,
783b4b21 167 'where' => 'civicrm_prevnext_cache.cachekey',
522a26c9 168 'table_name' => 'civicrm_prevnext_cache',
169 'entity' => 'PrevNextCache',
170 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 171 'localizable' => 0,
a9d0587b 172 'add' => '3.4',
c3fc2621
CW
173 ],
174 'data' => [
e501603b
TO
175 'name' => 'data',
176 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 177 'title' => ts('Prev Next Data'),
215b423e 178 'description' => ts('cached snapshot of the serialized data'),
a36434b9 179 'where' => 'civicrm_prevnext_cache.data',
522a26c9 180 'table_name' => 'civicrm_prevnext_cache',
181 'entity' => 'PrevNextCache',
182 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 183 'localizable' => 0,
2a5c9b4d 184 'serialize' => self::SERIALIZE_PHP,
a9d0587b 185 'add' => '3.4',
c3fc2621
CW
186 ],
187 'is_selected' => [
e501603b
TO
188 'name' => 'is_selected',
189 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 190 'title' => ts('Is Selected'),
a36434b9 191 'where' => 'civicrm_prevnext_cache.is_selected',
45a83e42 192 'default' => '0',
522a26c9 193 'table_name' => 'civicrm_prevnext_cache',
194 'entity' => 'PrevNextCache',
195 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 196 'localizable' => 0,
a9d0587b 197 'add' => '4.2',
c3fc2621
CW
198 ],
199 ];
346aaaba 200 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 201 }
346aaaba 202 return Civi::$statics[__CLASS__]['fields'];
e501603b 203 }
c3fc2621 204
e501603b 205 /**
bd8e0b14 206 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
207 *
208 * @return array
bd8e0b14 209 * Array(string $name => string $uniqueName).
e501603b 210 */
c3fc2621 211 public static function &fieldKeys() {
bd8e0b14
TO
212 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
213 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 214 }
bd8e0b14 215 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 216 }
c3fc2621 217
e501603b
TO
218 /**
219 * Returns the names of this table
220 *
221 * @return string
222 */
c3fc2621 223 public static function getTableName() {
e501603b
TO
224 return self::$_tableName;
225 }
c3fc2621 226
e501603b
TO
227 /**
228 * Returns if this table needs to be logged
229 *
c3fc2621 230 * @return bool
e501603b 231 */
c3fc2621 232 public function getLog() {
e501603b
TO
233 return self::$_log;
234 }
c3fc2621 235
e501603b
TO
236 /**
237 * Returns the list of fields that can be imported
238 *
239 * @param bool $prefix
240 *
241 * @return array
242 */
c3fc2621
CW
243 public static function &import($prefix = FALSE) {
244 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'prevnext_cache', $prefix, []);
60808919 245 return $r;
e501603b 246 }
c3fc2621 247
e501603b
TO
248 /**
249 * Returns the list of fields that can be exported
250 *
251 * @param bool $prefix
252 *
253 * @return array
254 */
c3fc2621
CW
255 public static function &export($prefix = FALSE) {
256 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'prevnext_cache', $prefix, []);
60808919 257 return $r;
e501603b 258 }
c3fc2621 259
e7a6b91a
AS
260 /**
261 * Returns the list of indices
c3fc2621
CW
262 *
263 * @param bool $localize
264 *
265 * @return array
e7a6b91a
AS
266 */
267 public static function indices($localize = TRUE) {
c3fc2621
CW
268 $indices = [
269 'index_all' => [
e7a6b91a 270 'name' => 'index_all',
c3fc2621 271 'field' => [
783b4b21 272 0 => 'cachekey',
e7a6b91a
AS
273 1 => 'entity_id1',
274 2 => 'entity_id2',
275 3 => 'entity_table',
276 4 => 'is_selected',
c3fc2621
CW
277 ],
278 'localizable' => FALSE,
783b4b21 279 'sig' => 'civicrm_prevnext_cache::0::cachekey::entity_id1::entity_id2::entity_table::is_selected',
c3fc2621
CW
280 ],
281 ];
e7a6b91a
AS
282 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
283 }
c3fc2621 284
e501603b 285}