Merge pull request #20471 from eileenmcnaughton/schema
[civicrm-core.git] / CRM / Event / Cart / DAO / EventInCart.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Event/Cart/EventInCart.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:872f4e67be93efbed14721bb030227db)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the EventInCart entity.
f41f0342 14 */
e501603b 15class CRM_Event_Cart_DAO_EventInCart extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
d31fb4e3 18 const COMPONENT = 'CiviEvent';
c3fc2621 19
e501603b 20 /**
f41f0342 21 * Static instance to hold the table name.
e501603b
TO
22 *
23 * @var string
24 */
fa45b5b9 25 public static $_tableName = 'civicrm_events_in_carts';
c3fc2621 26
e501603b 27 /**
f41f0342 28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 29 *
c3fc2621 30 * @var bool
e501603b 31 */
fa45b5b9 32 public static $_log = FALSE;
c3fc2621 33
e501603b 34 /**
2cbbebe8 35 * Event In Cart ID
e501603b 36 *
e6ca0a57 37 * @var int
e501603b
TO
38 */
39 public $id;
c3fc2621 40
e501603b
TO
41 /**
42 * FK to Event ID
43 *
e6ca0a57 44 * @var int
e501603b
TO
45 */
46 public $event_id;
c3fc2621 47
e501603b
TO
48 /**
49 * FK to Event Cart ID
50 *
e6ca0a57 51 * @var int
e501603b
TO
52 */
53 public $event_cart_id;
c3fc2621 54
e501603b 55 /**
f41f0342 56 * Class constructor.
e501603b 57 */
c3fc2621 58 public function __construct() {
e501603b
TO
59 $this->__table = 'civicrm_events_in_carts';
60 parent::__construct();
61 }
c3fc2621 62
449c4e6b
CW
63 /**
64 * Returns localized title of this entity.
7b66c3b5
AH
65 *
66 * @param bool $plural
67 * Whether to return the plural version of the title.
449c4e6b 68 */
7b66c3b5
AH
69 public static function getEntityTitle($plural = FALSE) {
70 return $plural ? ts('Event In Carts') : ts('Event In Cart');
449c4e6b
CW
71 }
72
e501603b 73 /**
f41f0342 74 * Returns foreign keys and entity references.
e501603b
TO
75 *
76 * @return array
77 * [CRM_Core_Reference_Interface]
78 */
c3fc2621 79 public static function getReferenceColumns() {
346aaaba 80 if (!isset(Civi::$statics[__CLASS__]['links'])) {
a36434b9 81 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
82 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_id', 'civicrm_event', 'id');
83 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_cart_id', 'civicrm_event_carts', 'id');
346aaaba 84 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 85 }
346aaaba 86 return Civi::$statics[__CLASS__]['links'];
e501603b 87 }
c3fc2621 88
e501603b
TO
89 /**
90 * Returns all the column names of this table
91 *
92 * @return array
93 */
c3fc2621 94 public static function &fields() {
346aaaba 95 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
96 Civi::$statics[__CLASS__]['fields'] = [
97 'event_in_cart_id' => [
e501603b
TO
98 'name' => 'id',
99 'type' => CRM_Utils_Type::T_INT,
c3fc2621 100 'title' => ts('Event In Cart'),
2cbbebe8 101 'description' => ts('Event In Cart ID'),
c3fc2621 102 'required' => TRUE,
a36434b9 103 'where' => 'civicrm_events_in_carts.id',
522a26c9 104 'table_name' => 'civicrm_events_in_carts',
105 'entity' => 'EventInCart',
106 'bao' => 'CRM_Event_Cart_BAO_EventInCart',
6a7e5e5d 107 'localizable' => 0,
2cbbebe8
A
108 'html' => [
109 'type' => 'Number',
110 ],
1fe423d6 111 'readonly' => TRUE,
a9d0587b 112 'add' => '4.1',
c3fc2621
CW
113 ],
114 'event_id' => [
e501603b
TO
115 'name' => 'event_id',
116 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 117 'title' => ts('Event ID'),
215b423e 118 'description' => ts('FK to Event ID'),
a36434b9 119 'where' => 'civicrm_events_in_carts.event_id',
522a26c9 120 'table_name' => 'civicrm_events_in_carts',
121 'entity' => 'EventInCart',
122 'bao' => 'CRM_Event_Cart_BAO_EventInCart',
6a7e5e5d 123 'localizable' => 0,
e501603b 124 'FKClassName' => 'CRM_Event_DAO_Event',
2cbbebe8
A
125 'html' => [
126 'label' => ts("Event"),
127 ],
a9d0587b 128 'add' => '4.1',
c3fc2621
CW
129 ],
130 'event_cart_id' => [
e501603b
TO
131 'name' => 'event_cart_id',
132 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 133 'title' => ts('Event Cart ID'),
215b423e 134 'description' => ts('FK to Event Cart ID'),
a36434b9 135 'where' => 'civicrm_events_in_carts.event_cart_id',
522a26c9 136 'table_name' => 'civicrm_events_in_carts',
137 'entity' => 'EventInCart',
138 'bao' => 'CRM_Event_Cart_BAO_EventInCart',
6a7e5e5d 139 'localizable' => 0,
e501603b 140 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
2cbbebe8
A
141 'html' => [
142 'label' => ts("Event In Cart"),
143 ],
a9d0587b 144 'add' => '4.1',
c3fc2621
CW
145 ],
146 ];
346aaaba 147 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 148 }
346aaaba 149 return Civi::$statics[__CLASS__]['fields'];
e501603b 150 }
c3fc2621 151
e501603b 152 /**
bd8e0b14 153 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
154 *
155 * @return array
bd8e0b14 156 * Array(string $name => string $uniqueName).
e501603b 157 */
c3fc2621 158 public static function &fieldKeys() {
bd8e0b14
TO
159 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
160 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 161 }
bd8e0b14 162 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 163 }
c3fc2621 164
e501603b
TO
165 /**
166 * Returns the names of this table
167 *
168 * @return string
169 */
c3fc2621 170 public static function getTableName() {
e501603b
TO
171 return self::$_tableName;
172 }
c3fc2621 173
e501603b
TO
174 /**
175 * Returns if this table needs to be logged
176 *
c3fc2621 177 * @return bool
e501603b 178 */
c3fc2621 179 public function getLog() {
e501603b
TO
180 return self::$_log;
181 }
c3fc2621 182
e501603b
TO
183 /**
184 * Returns the list of fields that can be imported
185 *
186 * @param bool $prefix
187 *
188 * @return array
189 */
c3fc2621
CW
190 public static function &import($prefix = FALSE) {
191 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'events_in_carts', $prefix, []);
60808919 192 return $r;
e501603b 193 }
c3fc2621 194
e501603b
TO
195 /**
196 * Returns the list of fields that can be exported
197 *
198 * @param bool $prefix
199 *
200 * @return array
201 */
c3fc2621
CW
202 public static function &export($prefix = FALSE) {
203 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'events_in_carts', $prefix, []);
60808919 204 return $r;
e501603b 205 }
c3fc2621 206
e7a6b91a
AS
207 /**
208 * Returns the list of indices
c3fc2621
CW
209 *
210 * @param bool $localize
211 *
212 * @return array
e7a6b91a
AS
213 */
214 public static function indices($localize = TRUE) {
c3fc2621 215 $indices = [];
e7a6b91a
AS
216 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
217 }
c3fc2621 218
e501603b 219}