API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[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:c0fdef43850965dce80a73e66caa3ceb)
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 'add' => '4.1',
100 ],
101 'user_id' => [
102 'name' => 'user_id',
103 'type' => CRM_Utils_Type::T_INT,
104 'title' => ts('Created By'),
105 'description' => ts('FK to civicrm_contact who created this cart'),
106 'where' => 'civicrm_event_carts.user_id',
107 'table_name' => 'civicrm_event_carts',
108 'entity' => 'Cart',
109 'bao' => 'CRM_Event_Cart_BAO_Cart',
110 'localizable' => 0,
111 'FKClassName' => 'CRM_Contact_DAO_Contact',
112 'add' => '4.1',
113 ],
114 'completed' => [
115 'name' => 'completed',
116 'type' => CRM_Utils_Type::T_BOOLEAN,
117 'title' => ts('Complete?'),
118 'where' => 'civicrm_event_carts.completed',
119 'default' => '0',
120 'table_name' => 'civicrm_event_carts',
121 'entity' => 'Cart',
122 'bao' => 'CRM_Event_Cart_BAO_Cart',
123 'localizable' => 0,
124 'add' => '4.1',
125 ],
126 ];
127 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
128 }
129 return Civi::$statics[__CLASS__]['fields'];
130 }
131
132 /**
133 * Return a mapping from field-name to the corresponding key (as used in fields()).
134 *
135 * @return array
136 * Array(string $name => string $uniqueName).
137 */
138 public static function &fieldKeys() {
139 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
140 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
141 }
142 return Civi::$statics[__CLASS__]['fieldKeys'];
143 }
144
145 /**
146 * Returns the names of this table
147 *
148 * @return string
149 */
150 public static function getTableName() {
151 return self::$_tableName;
152 }
153
154 /**
155 * Returns if this table needs to be logged
156 *
157 * @return bool
158 */
159 public function getLog() {
160 return self::$_log;
161 }
162
163 /**
164 * Returns the list of fields that can be imported
165 *
166 * @param bool $prefix
167 *
168 * @return array
169 */
170 public static function &import($prefix = FALSE) {
171 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'event_carts', $prefix, []);
172 return $r;
173 }
174
175 /**
176 * Returns the list of fields that can be exported
177 *
178 * @param bool $prefix
179 *
180 * @return array
181 */
182 public static function &export($prefix = FALSE) {
183 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'event_carts', $prefix, []);
184 return $r;
185 }
186
187 /**
188 * Returns the list of indices
189 *
190 * @param bool $localize
191 *
192 * @return array
193 */
194 public static function indices($localize = TRUE) {
195 $indices = [];
196 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
197 }
198
199 }