Merge pull request #17374 from totten/master-setlocale
[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:ff4dc6dfd849ffb9b89627be860bad2b)
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 localized title of this entity.
60 */
61 public static function getEntityTitle() {
62 return ts('Carts');
63 }
64
65 /**
66 * Returns foreign keys and entity references.
67 *
68 * @return array
69 * [CRM_Core_Reference_Interface]
70 */
71 public static function getReferenceColumns() {
72 if (!isset(Civi::$statics[__CLASS__]['links'])) {
73 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
74 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'user_id', 'civicrm_contact', 'id');
75 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
76 }
77 return Civi::$statics[__CLASS__]['links'];
78 }
79
80 /**
81 * Returns all the column names of this table
82 *
83 * @return array
84 */
85 public static function &fields() {
86 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
87 Civi::$statics[__CLASS__]['fields'] = [
88 'cart_id' => [
89 'name' => 'id',
90 'type' => CRM_Utils_Type::T_INT,
91 'title' => ts('Cart ID'),
92 'description' => ts('Cart Id'),
93 'required' => TRUE,
94 'where' => 'civicrm_event_carts.id',
95 'table_name' => 'civicrm_event_carts',
96 'entity' => 'Cart',
97 'bao' => 'CRM_Event_Cart_BAO_Cart',
98 'localizable' => 0,
99 ],
100 'user_id' => [
101 'name' => 'user_id',
102 'type' => CRM_Utils_Type::T_INT,
103 'title' => ts('Created By'),
104 'description' => ts('FK to civicrm_contact who created this cart'),
105 'where' => 'civicrm_event_carts.user_id',
106 'table_name' => 'civicrm_event_carts',
107 'entity' => 'Cart',
108 'bao' => 'CRM_Event_Cart_BAO_Cart',
109 'localizable' => 0,
110 'FKClassName' => 'CRM_Contact_DAO_Contact',
111 ],
112 'completed' => [
113 'name' => 'completed',
114 'type' => CRM_Utils_Type::T_BOOLEAN,
115 'title' => ts('Complete?'),
116 'where' => 'civicrm_event_carts.completed',
117 'default' => '0',
118 'table_name' => 'civicrm_event_carts',
119 'entity' => 'Cart',
120 'bao' => 'CRM_Event_Cart_BAO_Cart',
121 'localizable' => 0,
122 ],
123 ];
124 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
125 }
126 return Civi::$statics[__CLASS__]['fields'];
127 }
128
129 /**
130 * Return a mapping from field-name to the corresponding key (as used in fields()).
131 *
132 * @return array
133 * Array(string $name => string $uniqueName).
134 */
135 public static function &fieldKeys() {
136 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
137 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
138 }
139 return Civi::$statics[__CLASS__]['fieldKeys'];
140 }
141
142 /**
143 * Returns the names of this table
144 *
145 * @return string
146 */
147 public static function getTableName() {
148 return self::$_tableName;
149 }
150
151 /**
152 * Returns if this table needs to be logged
153 *
154 * @return bool
155 */
156 public function getLog() {
157 return self::$_log;
158 }
159
160 /**
161 * Returns the list of fields that can be imported
162 *
163 * @param bool $prefix
164 *
165 * @return array
166 */
167 public static function &import($prefix = FALSE) {
168 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'event_carts', $prefix, []);
169 return $r;
170 }
171
172 /**
173 * Returns the list of fields that can be exported
174 *
175 * @param bool $prefix
176 *
177 * @return array
178 */
179 public static function &export($prefix = FALSE) {
180 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'event_carts', $prefix, []);
181 return $r;
182 }
183
184 /**
185 * Returns the list of indices
186 *
187 * @param bool $localize
188 *
189 * @return array
190 */
191 public static function indices($localize = TRUE) {
192 $indices = [];
193 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
194 }
195
196 }