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