Regenerate DAOs with readonly attribute for id fields
[civicrm-core.git] / CRM / Contribute / DAO / Widget.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Contribute/Widget.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:68cffd0a5158d8a8d052556b9d4d6d7b)
10 */
11
12 /**
13 * Database access object for the Widget entity.
14 */
15 class CRM_Contribute_DAO_Widget extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.0';
18 const COMPONENT = 'CiviContribute';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_contribution_widget';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = TRUE;
33
34 /**
35 * Contribution ID
36 *
37 * @var int
38 */
39 public $id;
40
41 /**
42 * The Contribution Page which triggered this contribution
43 *
44 * @var int
45 */
46 public $contribution_page_id;
47
48 /**
49 * Is this property active?
50 *
51 * @var bool
52 */
53 public $is_active;
54
55 /**
56 * Widget title.
57 *
58 * @var string
59 */
60 public $title;
61
62 /**
63 * URL to Widget logo
64 *
65 * @var string
66 */
67 public $url_logo;
68
69 /**
70 * Button title.
71 *
72 * @var string
73 */
74 public $button_title;
75
76 /**
77 * About description.
78 *
79 * @var text
80 */
81 public $about;
82
83 /**
84 * URL to Homepage.
85 *
86 * @var string
87 */
88 public $url_homepage;
89
90 /**
91 * @var string
92 */
93 public $color_title;
94
95 /**
96 * @var string
97 */
98 public $color_button;
99
100 /**
101 * @var string
102 */
103 public $color_bar;
104
105 /**
106 * @var string
107 */
108 public $color_main_text;
109
110 /**
111 * @var string
112 */
113 public $color_main;
114
115 /**
116 * @var string
117 */
118 public $color_main_bg;
119
120 /**
121 * @var string
122 */
123 public $color_bg;
124
125 /**
126 * @var string
127 */
128 public $color_about_link;
129
130 /**
131 * @var string
132 */
133 public $color_homepage_link;
134
135 /**
136 * Class constructor.
137 */
138 public function __construct() {
139 $this->__table = 'civicrm_contribution_widget';
140 parent::__construct();
141 }
142
143 /**
144 * Returns localized title of this entity.
145 *
146 * @param bool $plural
147 * Whether to return the plural version of the title.
148 */
149 public static function getEntityTitle($plural = FALSE) {
150 return $plural ? ts('Widgets') : ts('Widget');
151 }
152
153 /**
154 * Returns foreign keys and entity references.
155 *
156 * @return array
157 * [CRM_Core_Reference_Interface]
158 */
159 public static function getReferenceColumns() {
160 if (!isset(Civi::$statics[__CLASS__]['links'])) {
161 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
162 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id');
163 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
164 }
165 return Civi::$statics[__CLASS__]['links'];
166 }
167
168 /**
169 * Returns all the column names of this table
170 *
171 * @return array
172 */
173 public static function &fields() {
174 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
175 Civi::$statics[__CLASS__]['fields'] = [
176 'id' => [
177 'name' => 'id',
178 'type' => CRM_Utils_Type::T_INT,
179 'title' => ts('Widget ID'),
180 'description' => ts('Contribution ID'),
181 'required' => TRUE,
182 'where' => 'civicrm_contribution_widget.id',
183 'table_name' => 'civicrm_contribution_widget',
184 'entity' => 'Widget',
185 'bao' => 'CRM_Contribute_BAO_Widget',
186 'localizable' => 0,
187 'html' => [
188 'type' => 'Number',
189 ],
190 'readonly' => TRUE,
191 'add' => '2.0',
192 ],
193 'contribution_page_id' => [
194 'name' => 'contribution_page_id',
195 'type' => CRM_Utils_Type::T_INT,
196 'title' => ts('Contribution Page ID'),
197 'description' => ts('The Contribution Page which triggered this contribution'),
198 'where' => 'civicrm_contribution_widget.contribution_page_id',
199 'table_name' => 'civicrm_contribution_widget',
200 'entity' => 'Widget',
201 'bao' => 'CRM_Contribute_BAO_Widget',
202 'localizable' => 0,
203 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
204 'html' => [
205 'label' => ts("Contribution Page"),
206 ],
207 'add' => '1.5',
208 ],
209 'is_active' => [
210 'name' => 'is_active',
211 'type' => CRM_Utils_Type::T_BOOLEAN,
212 'title' => ts('Enabled?'),
213 'description' => ts('Is this property active?'),
214 'where' => 'civicrm_contribution_widget.is_active',
215 'table_name' => 'civicrm_contribution_widget',
216 'entity' => 'Widget',
217 'bao' => 'CRM_Contribute_BAO_Widget',
218 'localizable' => 0,
219 'add' => '2.0',
220 ],
221 'title' => [
222 'name' => 'title',
223 'type' => CRM_Utils_Type::T_STRING,
224 'title' => ts('Widget Title'),
225 'description' => ts('Widget title.'),
226 'maxlength' => 255,
227 'size' => CRM_Utils_Type::HUGE,
228 'where' => 'civicrm_contribution_widget.title',
229 'table_name' => 'civicrm_contribution_widget',
230 'entity' => 'Widget',
231 'bao' => 'CRM_Contribute_BAO_Widget',
232 'localizable' => 0,
233 'add' => '2.0',
234 ],
235 'url_logo' => [
236 'name' => 'url_logo',
237 'type' => CRM_Utils_Type::T_STRING,
238 'title' => ts('Widget Image Url'),
239 'description' => ts('URL to Widget logo'),
240 'maxlength' => 255,
241 'size' => CRM_Utils_Type::HUGE,
242 'where' => 'civicrm_contribution_widget.url_logo',
243 'table_name' => 'civicrm_contribution_widget',
244 'entity' => 'Widget',
245 'bao' => 'CRM_Contribute_BAO_Widget',
246 'localizable' => 0,
247 'add' => '2.0',
248 ],
249 'button_title' => [
250 'name' => 'button_title',
251 'type' => CRM_Utils_Type::T_STRING,
252 'title' => ts('Button Title'),
253 'description' => ts('Button title.'),
254 'maxlength' => 255,
255 'size' => CRM_Utils_Type::HUGE,
256 'where' => 'civicrm_contribution_widget.button_title',
257 'table_name' => 'civicrm_contribution_widget',
258 'entity' => 'Widget',
259 'bao' => 'CRM_Contribute_BAO_Widget',
260 'localizable' => 0,
261 'add' => '2.0',
262 ],
263 'about' => [
264 'name' => 'about',
265 'type' => CRM_Utils_Type::T_TEXT,
266 'title' => ts('Description'),
267 'description' => ts('About description.'),
268 'where' => 'civicrm_contribution_widget.about',
269 'table_name' => 'civicrm_contribution_widget',
270 'entity' => 'Widget',
271 'bao' => 'CRM_Contribute_BAO_Widget',
272 'localizable' => 0,
273 'add' => '2.0',
274 ],
275 'url_homepage' => [
276 'name' => 'url_homepage',
277 'type' => CRM_Utils_Type::T_STRING,
278 'title' => ts('Homepage Url'),
279 'description' => ts('URL to Homepage.'),
280 'maxlength' => 255,
281 'size' => CRM_Utils_Type::HUGE,
282 'where' => 'civicrm_contribution_widget.url_homepage',
283 'table_name' => 'civicrm_contribution_widget',
284 'entity' => 'Widget',
285 'bao' => 'CRM_Contribute_BAO_Widget',
286 'localizable' => 0,
287 'add' => '2.0',
288 ],
289 'color_title' => [
290 'name' => 'color_title',
291 'type' => CRM_Utils_Type::T_STRING,
292 'title' => ts('Title Color'),
293 'maxlength' => 10,
294 'size' => CRM_Utils_Type::TWELVE,
295 'where' => 'civicrm_contribution_widget.color_title',
296 'table_name' => 'civicrm_contribution_widget',
297 'entity' => 'Widget',
298 'bao' => 'CRM_Contribute_BAO_Widget',
299 'localizable' => 0,
300 'add' => '2.0',
301 ],
302 'color_button' => [
303 'name' => 'color_button',
304 'type' => CRM_Utils_Type::T_STRING,
305 'title' => ts('Button Color'),
306 'maxlength' => 10,
307 'size' => CRM_Utils_Type::TWELVE,
308 'where' => 'civicrm_contribution_widget.color_button',
309 'table_name' => 'civicrm_contribution_widget',
310 'entity' => 'Widget',
311 'bao' => 'CRM_Contribute_BAO_Widget',
312 'localizable' => 0,
313 'add' => '2.0',
314 ],
315 'color_bar' => [
316 'name' => 'color_bar',
317 'type' => CRM_Utils_Type::T_STRING,
318 'title' => ts('Bar Color'),
319 'maxlength' => 10,
320 'size' => CRM_Utils_Type::TWELVE,
321 'where' => 'civicrm_contribution_widget.color_bar',
322 'table_name' => 'civicrm_contribution_widget',
323 'entity' => 'Widget',
324 'bao' => 'CRM_Contribute_BAO_Widget',
325 'localizable' => 0,
326 'add' => '2.0',
327 ],
328 'color_main_text' => [
329 'name' => 'color_main_text',
330 'type' => CRM_Utils_Type::T_STRING,
331 'title' => ts('Main Text Color'),
332 'maxlength' => 10,
333 'size' => CRM_Utils_Type::TWELVE,
334 'where' => 'civicrm_contribution_widget.color_main_text',
335 'table_name' => 'civicrm_contribution_widget',
336 'entity' => 'Widget',
337 'bao' => 'CRM_Contribute_BAO_Widget',
338 'localizable' => 0,
339 'add' => '2.0',
340 ],
341 'color_main' => [
342 'name' => 'color_main',
343 'type' => CRM_Utils_Type::T_STRING,
344 'title' => ts('Main Color'),
345 'maxlength' => 10,
346 'size' => CRM_Utils_Type::TWELVE,
347 'where' => 'civicrm_contribution_widget.color_main',
348 'table_name' => 'civicrm_contribution_widget',
349 'entity' => 'Widget',
350 'bao' => 'CRM_Contribute_BAO_Widget',
351 'localizable' => 0,
352 'add' => '2.0',
353 ],
354 'color_main_bg' => [
355 'name' => 'color_main_bg',
356 'type' => CRM_Utils_Type::T_STRING,
357 'title' => ts('Background Color'),
358 'maxlength' => 10,
359 'size' => CRM_Utils_Type::TWELVE,
360 'where' => 'civicrm_contribution_widget.color_main_bg',
361 'table_name' => 'civicrm_contribution_widget',
362 'entity' => 'Widget',
363 'bao' => 'CRM_Contribute_BAO_Widget',
364 'localizable' => 0,
365 'add' => '2.0',
366 ],
367 'color_bg' => [
368 'name' => 'color_bg',
369 'type' => CRM_Utils_Type::T_STRING,
370 'title' => ts('Other Background Color'),
371 'maxlength' => 10,
372 'size' => CRM_Utils_Type::TWELVE,
373 'where' => 'civicrm_contribution_widget.color_bg',
374 'table_name' => 'civicrm_contribution_widget',
375 'entity' => 'Widget',
376 'bao' => 'CRM_Contribute_BAO_Widget',
377 'localizable' => 0,
378 'add' => '2.0',
379 ],
380 'color_about_link' => [
381 'name' => 'color_about_link',
382 'type' => CRM_Utils_Type::T_STRING,
383 'title' => ts('About Link Color'),
384 'maxlength' => 10,
385 'size' => CRM_Utils_Type::TWELVE,
386 'where' => 'civicrm_contribution_widget.color_about_link',
387 'table_name' => 'civicrm_contribution_widget',
388 'entity' => 'Widget',
389 'bao' => 'CRM_Contribute_BAO_Widget',
390 'localizable' => 0,
391 'add' => '2.0',
392 ],
393 'color_homepage_link' => [
394 'name' => 'color_homepage_link',
395 'type' => CRM_Utils_Type::T_STRING,
396 'title' => ts('Homepage Link Color'),
397 'maxlength' => 10,
398 'size' => CRM_Utils_Type::TWELVE,
399 'where' => 'civicrm_contribution_widget.color_homepage_link',
400 'table_name' => 'civicrm_contribution_widget',
401 'entity' => 'Widget',
402 'bao' => 'CRM_Contribute_BAO_Widget',
403 'localizable' => 0,
404 'add' => '2.0',
405 ],
406 ];
407 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
408 }
409 return Civi::$statics[__CLASS__]['fields'];
410 }
411
412 /**
413 * Return a mapping from field-name to the corresponding key (as used in fields()).
414 *
415 * @return array
416 * Array(string $name => string $uniqueName).
417 */
418 public static function &fieldKeys() {
419 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
420 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
421 }
422 return Civi::$statics[__CLASS__]['fieldKeys'];
423 }
424
425 /**
426 * Returns the names of this table
427 *
428 * @return string
429 */
430 public static function getTableName() {
431 return self::$_tableName;
432 }
433
434 /**
435 * Returns if this table needs to be logged
436 *
437 * @return bool
438 */
439 public function getLog() {
440 return self::$_log;
441 }
442
443 /**
444 * Returns the list of fields that can be imported
445 *
446 * @param bool $prefix
447 *
448 * @return array
449 */
450 public static function &import($prefix = FALSE) {
451 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_widget', $prefix, []);
452 return $r;
453 }
454
455 /**
456 * Returns the list of fields that can be exported
457 *
458 * @param bool $prefix
459 *
460 * @return array
461 */
462 public static function &export($prefix = FALSE) {
463 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_widget', $prefix, []);
464 return $r;
465 }
466
467 /**
468 * Returns the list of indices
469 *
470 * @param bool $localize
471 *
472 * @return array
473 */
474 public static function indices($localize = TRUE) {
475 $indices = [];
476 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
477 }
478
479 }