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