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