Merge pull request #15415 from ixiam/dev_issue#1297
[civicrm-core.git] / CRM / Core / DAO / PrevNextCache.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/PrevNextCache.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ddd681f365e2e377c23188cf3563c522)
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 all the column names of this table
86 *
87 * @return array
88 */
89 public static function &fields() {
90 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
91 Civi::$statics[__CLASS__]['fields'] = [
92 'id' => [
93 'name' => 'id',
94 'type' => CRM_Utils_Type::T_INT,
95 'title' => ts('Prev Next Cache ID'),
96 'required' => TRUE,
97 'where' => 'civicrm_prevnext_cache.id',
98 'table_name' => 'civicrm_prevnext_cache',
99 'entity' => 'PrevNextCache',
100 'bao' => 'CRM_Core_BAO_PrevNextCache',
101 'localizable' => 0,
102 ],
103 'entity_table' => [
104 'name' => 'entity_table',
105 'type' => CRM_Utils_Type::T_STRING,
106 'title' => ts('Prev Next Entity Table'),
107 'description' => ts('physical tablename for entity being joined to discount, e.g. civicrm_event'),
108 'maxlength' => 64,
109 'size' => CRM_Utils_Type::BIG,
110 'where' => 'civicrm_prevnext_cache.entity_table',
111 'table_name' => 'civicrm_prevnext_cache',
112 'entity' => 'PrevNextCache',
113 'bao' => 'CRM_Core_BAO_PrevNextCache',
114 'localizable' => 0,
115 ],
116 'entity_id1' => [
117 'name' => 'entity_id1',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('Prev Next Entity ID 1'),
120 'description' => ts('FK to entity table specified in entity_table column.'),
121 'required' => TRUE,
122 'where' => 'civicrm_prevnext_cache.entity_id1',
123 'table_name' => 'civicrm_prevnext_cache',
124 'entity' => 'PrevNextCache',
125 'bao' => 'CRM_Core_BAO_PrevNextCache',
126 'localizable' => 0,
127 ],
128 'entity_id2' => [
129 'name' => 'entity_id2',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('Prev Next Entity ID 2'),
132 'description' => ts('FK to entity table specified in entity_table column.'),
133 'required' => FALSE,
134 'where' => 'civicrm_prevnext_cache.entity_id2',
135 'table_name' => 'civicrm_prevnext_cache',
136 'entity' => 'PrevNextCache',
137 'bao' => 'CRM_Core_BAO_PrevNextCache',
138 'localizable' => 0,
139 ],
140 'cachekey' => [
141 'name' => 'cachekey',
142 'type' => CRM_Utils_Type::T_STRING,
143 'title' => ts('Cache Key'),
144 'description' => ts('Unique path name for cache element of the searched item'),
145 'maxlength' => 255,
146 'size' => CRM_Utils_Type::HUGE,
147 'where' => 'civicrm_prevnext_cache.cachekey',
148 'table_name' => 'civicrm_prevnext_cache',
149 'entity' => 'PrevNextCache',
150 'bao' => 'CRM_Core_BAO_PrevNextCache',
151 'localizable' => 0,
152 ],
153 'data' => [
154 'name' => 'data',
155 'type' => CRM_Utils_Type::T_LONGTEXT,
156 'title' => ts('Prev Next Data'),
157 'description' => ts('cached snapshot of the serialized data'),
158 'where' => 'civicrm_prevnext_cache.data',
159 'table_name' => 'civicrm_prevnext_cache',
160 'entity' => 'PrevNextCache',
161 'bao' => 'CRM_Core_BAO_PrevNextCache',
162 'localizable' => 0,
163 'serialize' => self::SERIALIZE_PHP,
164 ],
165 'is_selected' => [
166 'name' => 'is_selected',
167 'type' => CRM_Utils_Type::T_BOOLEAN,
168 'title' => ts('Is Selected'),
169 'where' => 'civicrm_prevnext_cache.is_selected',
170 'default' => '0',
171 'table_name' => 'civicrm_prevnext_cache',
172 'entity' => 'PrevNextCache',
173 'bao' => 'CRM_Core_BAO_PrevNextCache',
174 'localizable' => 0,
175 ],
176 ];
177 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
178 }
179 return Civi::$statics[__CLASS__]['fields'];
180 }
181
182 /**
183 * Return a mapping from field-name to the corresponding key (as used in fields()).
184 *
185 * @return array
186 * Array(string $name => string $uniqueName).
187 */
188 public static function &fieldKeys() {
189 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
190 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
191 }
192 return Civi::$statics[__CLASS__]['fieldKeys'];
193 }
194
195 /**
196 * Returns the names of this table
197 *
198 * @return string
199 */
200 public static function getTableName() {
201 return self::$_tableName;
202 }
203
204 /**
205 * Returns if this table needs to be logged
206 *
207 * @return bool
208 */
209 public function getLog() {
210 return self::$_log;
211 }
212
213 /**
214 * Returns the list of fields that can be imported
215 *
216 * @param bool $prefix
217 *
218 * @return array
219 */
220 public static function &import($prefix = FALSE) {
221 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'prevnext_cache', $prefix, []);
222 return $r;
223 }
224
225 /**
226 * Returns the list of fields that can be exported
227 *
228 * @param bool $prefix
229 *
230 * @return array
231 */
232 public static function &export($prefix = FALSE) {
233 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'prevnext_cache', $prefix, []);
234 return $r;
235 }
236
237 /**
238 * Returns the list of indices
239 *
240 * @param bool $localize
241 *
242 * @return array
243 */
244 public static function indices($localize = TRUE) {
245 $indices = [
246 'index_all' => [
247 'name' => 'index_all',
248 'field' => [
249 0 => 'cachekey',
250 1 => 'entity_id1',
251 2 => 'entity_id2',
252 3 => 'entity_table',
253 4 => 'is_selected',
254 ],
255 'localizable' => FALSE,
256 'sig' => 'civicrm_prevnext_cache::0::cachekey::entity_id1::entity_id2::entity_table::is_selected',
257 ],
258 ];
259 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
260 }
261
262 }