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