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