Merge pull request #16175 from eileenmcnaughton/get_acls
[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:57220a9c79c8b801d23ed0c31cb18a63)
10 */
11
12 /**
13 * Database access object for the Cart entity.
14 */
15 class CRM_Event_Cart_DAO_Cart extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_event_carts';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = FALSE;
30
31 /**
32 * Cart Id
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * FK to civicrm_contact who created this cart
40 *
41 * @var int
42 */
43 public $user_id;
44
45 /**
46 * @var bool
47 */
48 public $completed;
49
50 /**
51 * Class constructor.
52 */
53 public function __construct() {
54 $this->__table = 'civicrm_event_carts';
55 parent::__construct();
56 }
57
58 /**
59 * Returns foreign keys and entity references.
60 *
61 * @return array
62 * [CRM_Core_Reference_Interface]
63 */
64 public static function getReferenceColumns() {
65 if (!isset(Civi::$statics[__CLASS__]['links'])) {
66 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
67 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'user_id', 'civicrm_contact', 'id');
68 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
69 }
70 return Civi::$statics[__CLASS__]['links'];
71 }
72
73 /**
74 * Returns all the column names of this table
75 *
76 * @return array
77 */
78 public static function &fields() {
79 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
80 Civi::$statics[__CLASS__]['fields'] = [
81 'cart_id' => [
82 'name' => 'id',
83 'type' => CRM_Utils_Type::T_INT,
84 'title' => ts('Cart ID'),
85 'description' => ts('Cart Id'),
86 'required' => TRUE,
87 'where' => 'civicrm_event_carts.id',
88 'table_name' => 'civicrm_event_carts',
89 'entity' => 'Cart',
90 'bao' => 'CRM_Event_Cart_BAO_Cart',
91 'localizable' => 0,
92 ],
93 'user_id' => [
94 'name' => 'user_id',
95 'type' => CRM_Utils_Type::T_INT,
96 'title' => ts('Created By'),
97 'description' => ts('FK to civicrm_contact who created this cart'),
98 'where' => 'civicrm_event_carts.user_id',
99 'table_name' => 'civicrm_event_carts',
100 'entity' => 'Cart',
101 'bao' => 'CRM_Event_Cart_BAO_Cart',
102 'localizable' => 0,
103 'FKClassName' => 'CRM_Contact_DAO_Contact',
104 ],
105 'completed' => [
106 'name' => 'completed',
107 'type' => CRM_Utils_Type::T_BOOLEAN,
108 'title' => ts('Complete?'),
109 'where' => 'civicrm_event_carts.completed',
110 'default' => '0',
111 'table_name' => 'civicrm_event_carts',
112 'entity' => 'Cart',
113 'bao' => 'CRM_Event_Cart_BAO_Cart',
114 'localizable' => 0,
115 ],
116 ];
117 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
118 }
119 return Civi::$statics[__CLASS__]['fields'];
120 }
121
122 /**
123 * Return a mapping from field-name to the corresponding key (as used in fields()).
124 *
125 * @return array
126 * Array(string $name => string $uniqueName).
127 */
128 public static function &fieldKeys() {
129 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
130 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
131 }
132 return Civi::$statics[__CLASS__]['fieldKeys'];
133 }
134
135 /**
136 * Returns the names of this table
137 *
138 * @return string
139 */
140 public static function getTableName() {
141 return self::$_tableName;
142 }
143
144 /**
145 * Returns if this table needs to be logged
146 *
147 * @return bool
148 */
149 public function getLog() {
150 return self::$_log;
151 }
152
153 /**
154 * Returns the list of fields that can be imported
155 *
156 * @param bool $prefix
157 *
158 * @return array
159 */
160 public static function &import($prefix = FALSE) {
161 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'event_carts', $prefix, []);
162 return $r;
163 }
164
165 /**
166 * Returns the list of fields that can be exported
167 *
168 * @param bool $prefix
169 *
170 * @return array
171 */
172 public static function &export($prefix = FALSE) {
173 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'event_carts', $prefix, []);
174 return $r;
175 }
176
177 /**
178 * Returns the list of indices
179 *
180 * @param bool $localize
181 *
182 * @return array
183 */
184 public static function indices($localize = TRUE) {
185 $indices = [];
186 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
187 }
188
189 }