5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Event/Cart/Cart.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:58e30874811fa80b8a405f368004e697)
13 * Database access object for the Cart entity.
15 class CRM_Event_Cart_DAO_Cart
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '';
18 const COMPONENT
= 'CiviEvent';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_event_carts';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
37 * @var int|string|null
38 * (SQL type: int unsigned)
39 * Note that values will be retrieved from the database as a string.
44 * FK to civicrm_contact who created this cart
46 * @var int|string|null
47 * (SQL type: int unsigned)
48 * Note that values will be retrieved from the database as a string.
53 * @var bool|string|null
55 * Note that values will be retrieved from the database as a string.
62 public function __construct() {
63 $this->__table
= 'civicrm_event_carts';
64 parent
::__construct();
68 * Returns localized title of this entity.
71 * Whether to return the plural version of the title.
73 public static function getEntityTitle($plural = FALSE) {
74 return $plural ?
ts('Carts') : ts('Cart');
78 * Returns foreign keys and entity references.
81 * [CRM_Core_Reference_Interface]
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']);
89 return Civi
::$statics[__CLASS__
]['links'];
93 * Returns all the column names of this table
97 public static function &fields() {
98 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
99 Civi
::$statics[__CLASS__
]['fields'] = [
102 'type' => CRM_Utils_Type
::T_INT
,
103 'title' => ts('Cart ID'),
104 'description' => ts('Cart ID'),
106 'where' => 'civicrm_event_carts.id',
107 'table_name' => 'civicrm_event_carts',
109 'bao' => 'CRM_Event_Cart_BAO_Cart',
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',
125 'bao' => 'CRM_Event_Cart_BAO_Cart',
127 'FKClassName' => 'CRM_Contact_DAO_Contact',
129 'label' => ts("Created By"),
134 'name' => 'completed',
135 'type' => CRM_Utils_Type
::T_BOOLEAN
,
136 'title' => ts('Complete?'),
137 'where' => 'civicrm_event_carts.completed',
139 'table_name' => 'civicrm_event_carts',
141 'bao' => 'CRM_Event_Cart_BAO_Cart',
146 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
148 return Civi
::$statics[__CLASS__
]['fields'];
152 * Return a mapping from field-name to the corresponding key (as used in fields()).
155 * Array(string $name => string $uniqueName).
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()));
161 return Civi
::$statics[__CLASS__
]['fieldKeys'];
165 * Returns the names of this table
169 public static function getTableName() {
170 return self
::$_tableName;
174 * Returns if this table needs to be logged
178 public function getLog() {
183 * Returns the list of fields that can be imported
185 * @param bool $prefix
189 public static function &import($prefix = FALSE) {
190 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'event_carts', $prefix, []);
195 * Returns the list of fields that can be exported
197 * @param bool $prefix
201 public static function &export($prefix = FALSE) {
202 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'event_carts', $prefix, []);
207 * Returns the list of indices
209 * @param bool $localize
213 public static function indices($localize = TRUE) {
215 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;