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