Merge pull request #23942 from tschuettler/3717-sort-mapping-page
[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
c1e814c7 9 * (GenCodeChecksum:f024b706891db44527cdb153c1cdaea7)
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 /**
28979d65
CW
34 * @var int|string|null
35 * (SQL type: int unsigned)
36 * Note that values will be retrieved from the database as a string.
e501603b
TO
37 */
38 public $id;
c3fc2621 39
e501603b
TO
40 /**
41 * physical tablename for entity being joined to discount, e.g. civicrm_event
42 *
28979d65
CW
43 * @var string|null
44 * (SQL type: varchar(64))
45 * Note that values will be retrieved from the database as a string.
e501603b
TO
46 */
47 public $entity_table;
c3fc2621 48
e501603b
TO
49 /**
50 * FK to entity table specified in entity_table column.
51 *
28979d65
CW
52 * @var int|string
53 * (SQL type: int unsigned)
54 * Note that values will be retrieved from the database as a string.
e501603b
TO
55 */
56 public $entity_id1;
c3fc2621 57
e501603b
TO
58 /**
59 * FK to entity table specified in entity_table column.
60 *
28979d65
CW
61 * @var int|string
62 * (SQL type: int unsigned)
63 * Note that values will be retrieved from the database as a string.
e501603b
TO
64 */
65 public $entity_id2;
c3fc2621 66
e501603b
TO
67 /**
68 * Unique path name for cache element of the searched item
69 *
28979d65
CW
70 * @var string|null
71 * (SQL type: varchar(255))
72 * Note that values will be retrieved from the database as a string.
e501603b 73 */
783b4b21 74 public $cachekey;
c3fc2621 75
e501603b
TO
76 /**
77 * cached snapshot of the serialized data
78 *
28979d65
CW
79 * @var string|null
80 * (SQL type: longtext)
81 * Note that values will be retrieved from the database as a string.
e501603b
TO
82 */
83 public $data;
c3fc2621 84
e501603b 85 /**
c1e814c7 86 * @var bool|string
28979d65
CW
87 * (SQL type: tinyint)
88 * Note that values will be retrieved from the database as a string.
e501603b
TO
89 */
90 public $is_selected;
c3fc2621 91
e501603b 92 /**
f41f0342 93 * Class constructor.
e501603b 94 */
c3fc2621 95 public function __construct() {
e501603b
TO
96 $this->__table = 'civicrm_prevnext_cache';
97 parent::__construct();
98 }
c3fc2621 99
449c4e6b
CW
100 /**
101 * Returns localized title of this entity.
7b66c3b5
AH
102 *
103 * @param bool $plural
104 * Whether to return the plural version of the title.
449c4e6b 105 */
7b66c3b5
AH
106 public static function getEntityTitle($plural = FALSE) {
107 return $plural ? ts('Prev Next Caches') : ts('Prev Next Cache');
449c4e6b
CW
108 }
109
e501603b
TO
110 /**
111 * Returns all the column names of this table
112 *
113 * @return array
114 */
c3fc2621 115 public static function &fields() {
346aaaba 116 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
117 Civi::$statics[__CLASS__]['fields'] = [
118 'id' => [
e501603b
TO
119 'name' => 'id',
120 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
121 'title' => ts('Prev Next Cache ID'),
122 'required' => TRUE,
a36434b9 123 'where' => 'civicrm_prevnext_cache.id',
522a26c9 124 'table_name' => 'civicrm_prevnext_cache',
125 'entity' => 'PrevNextCache',
126 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 127 'localizable' => 0,
2cbbebe8
A
128 'html' => [
129 'type' => 'Number',
130 ],
1fe423d6 131 'readonly' => TRUE,
a9d0587b 132 'add' => '3.4',
c3fc2621
CW
133 ],
134 'entity_table' => [
e501603b
TO
135 'name' => 'entity_table',
136 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 137 'title' => ts('Prev Next Entity Table'),
215b423e 138 'description' => ts('physical tablename for entity being joined to discount, e.g. civicrm_event'),
e501603b
TO
139 'maxlength' => 64,
140 'size' => CRM_Utils_Type::BIG,
a36434b9 141 'where' => 'civicrm_prevnext_cache.entity_table',
522a26c9 142 'table_name' => 'civicrm_prevnext_cache',
143 'entity' => 'PrevNextCache',
144 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 145 'localizable' => 0,
a9d0587b 146 'add' => '3.4',
c3fc2621
CW
147 ],
148 'entity_id1' => [
e501603b
TO
149 'name' => 'entity_id1',
150 'type' => CRM_Utils_Type::T_INT,
c3fc2621 151 'title' => ts('Prev Next Entity ID 1'),
215b423e 152 'description' => ts('FK to entity table specified in entity_table column.'),
c3fc2621 153 'required' => TRUE,
a36434b9 154 'where' => 'civicrm_prevnext_cache.entity_id1',
522a26c9 155 'table_name' => 'civicrm_prevnext_cache',
156 'entity' => 'PrevNextCache',
157 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 158 'localizable' => 0,
a9d0587b 159 'add' => '3.4',
c3fc2621
CW
160 ],
161 'entity_id2' => [
e501603b
TO
162 'name' => 'entity_id2',
163 'type' => CRM_Utils_Type::T_INT,
c3fc2621 164 'title' => ts('Prev Next Entity ID 2'),
215b423e 165 'description' => ts('FK to entity table specified in entity_table column.'),
230a9938 166 'required' => FALSE,
a36434b9 167 'where' => 'civicrm_prevnext_cache.entity_id2',
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 173 ],
783b4b21
SL
174 'cachekey' => [
175 'name' => 'cachekey',
e501603b 176 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 177 'title' => ts('Cache Key'),
215b423e 178 'description' => ts('Unique path name for cache element of the searched item'),
e501603b
TO
179 'maxlength' => 255,
180 'size' => CRM_Utils_Type::HUGE,
783b4b21 181 'where' => 'civicrm_prevnext_cache.cachekey',
522a26c9 182 'table_name' => 'civicrm_prevnext_cache',
183 'entity' => 'PrevNextCache',
184 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 185 'localizable' => 0,
a9d0587b 186 'add' => '3.4',
c3fc2621
CW
187 ],
188 'data' => [
e501603b
TO
189 'name' => 'data',
190 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 191 'title' => ts('Prev Next Data'),
215b423e 192 'description' => ts('cached snapshot of the serialized data'),
a36434b9 193 'where' => 'civicrm_prevnext_cache.data',
522a26c9 194 'table_name' => 'civicrm_prevnext_cache',
195 'entity' => 'PrevNextCache',
196 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 197 'localizable' => 0,
2a5c9b4d 198 'serialize' => self::SERIALIZE_PHP,
a9d0587b 199 'add' => '3.4',
c3fc2621
CW
200 ],
201 'is_selected' => [
e501603b
TO
202 'name' => 'is_selected',
203 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 204 'title' => ts('Is Selected'),
c1e814c7 205 'required' => TRUE,
a36434b9 206 'where' => 'civicrm_prevnext_cache.is_selected',
45a83e42 207 'default' => '0',
522a26c9 208 'table_name' => 'civicrm_prevnext_cache',
209 'entity' => 'PrevNextCache',
210 'bao' => 'CRM_Core_BAO_PrevNextCache',
6a7e5e5d 211 'localizable' => 0,
a9d0587b 212 'add' => '4.2',
c3fc2621
CW
213 ],
214 ];
346aaaba 215 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 216 }
346aaaba 217 return Civi::$statics[__CLASS__]['fields'];
e501603b 218 }
c3fc2621 219
e501603b 220 /**
bd8e0b14 221 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
222 *
223 * @return array
bd8e0b14 224 * Array(string $name => string $uniqueName).
e501603b 225 */
c3fc2621 226 public static function &fieldKeys() {
bd8e0b14
TO
227 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
228 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 229 }
bd8e0b14 230 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 231 }
c3fc2621 232
e501603b
TO
233 /**
234 * Returns the names of this table
235 *
236 * @return string
237 */
c3fc2621 238 public static function getTableName() {
e501603b
TO
239 return self::$_tableName;
240 }
c3fc2621 241
e501603b
TO
242 /**
243 * Returns if this table needs to be logged
244 *
c3fc2621 245 * @return bool
e501603b 246 */
c3fc2621 247 public function getLog() {
e501603b
TO
248 return self::$_log;
249 }
c3fc2621 250
e501603b
TO
251 /**
252 * Returns the list of fields that can be imported
253 *
254 * @param bool $prefix
255 *
256 * @return array
257 */
c3fc2621
CW
258 public static function &import($prefix = FALSE) {
259 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'prevnext_cache', $prefix, []);
60808919 260 return $r;
e501603b 261 }
c3fc2621 262
e501603b
TO
263 /**
264 * Returns the list of fields that can be exported
265 *
266 * @param bool $prefix
267 *
268 * @return array
269 */
c3fc2621
CW
270 public static function &export($prefix = FALSE) {
271 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'prevnext_cache', $prefix, []);
60808919 272 return $r;
e501603b 273 }
c3fc2621 274
e7a6b91a
AS
275 /**
276 * Returns the list of indices
c3fc2621
CW
277 *
278 * @param bool $localize
279 *
280 * @return array
e7a6b91a
AS
281 */
282 public static function indices($localize = TRUE) {
c3fc2621
CW
283 $indices = [
284 'index_all' => [
e7a6b91a 285 'name' => 'index_all',
c3fc2621 286 'field' => [
783b4b21 287 0 => 'cachekey',
e7a6b91a
AS
288 1 => 'entity_id1',
289 2 => 'entity_id2',
290 3 => 'entity_table',
291 4 => 'is_selected',
c3fc2621
CW
292 ],
293 'localizable' => FALSE,
783b4b21 294 'sig' => 'civicrm_prevnext_cache::0::cachekey::entity_id1::entity_id2::entity_table::is_selected',
c3fc2621
CW
295 ],
296 ];
e7a6b91a
AS
297 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
298 }
c3fc2621 299
e501603b 300}