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:889446482ab589edebb02d7abee76bc5)
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;
42 * FK to civicrm_contact who created this cart
56 public function __construct() {
57 $this->__table
= 'civicrm_event_carts';
58 parent
::__construct();
62 * Returns localized title of this entity.
65 * Whether to return the plural version of the title.
67 public static function getEntityTitle($plural = FALSE) {
68 return $plural ?
ts('Carts') : ts('Cart');
72 * Returns foreign keys and entity references.
75 * [CRM_Core_Reference_Interface]
77 public static function getReferenceColumns() {
78 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
79 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
80 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'user_id', 'civicrm_contact', 'id');
81 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
83 return Civi
::$statics[__CLASS__
]['links'];
87 * Returns all the column names of this table
91 public static function &fields() {
92 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
93 Civi
::$statics[__CLASS__
]['fields'] = [
96 'type' => CRM_Utils_Type
::T_INT
,
97 'title' => ts('Cart ID'),
98 'description' => ts('Cart ID'),
100 'where' => 'civicrm_event_carts.id',
101 'table_name' => 'civicrm_event_carts',
103 'bao' => 'CRM_Event_Cart_BAO_Cart',
113 'type' => CRM_Utils_Type
::T_INT
,
114 'title' => ts('Created By Contact ID'),
115 'description' => ts('FK to civicrm_contact who created this cart'),
116 'where' => 'civicrm_event_carts.user_id',
117 'table_name' => 'civicrm_event_carts',
119 'bao' => 'CRM_Event_Cart_BAO_Cart',
121 'FKClassName' => 'CRM_Contact_DAO_Contact',
123 'label' => ts("Created By"),
128 'name' => 'completed',
129 'type' => CRM_Utils_Type
::T_BOOLEAN
,
130 'title' => ts('Complete?'),
131 'where' => 'civicrm_event_carts.completed',
133 'table_name' => 'civicrm_event_carts',
135 'bao' => 'CRM_Event_Cart_BAO_Cart',
140 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
142 return Civi
::$statics[__CLASS__
]['fields'];
146 * Return a mapping from field-name to the corresponding key (as used in fields()).
149 * Array(string $name => string $uniqueName).
151 public static function &fieldKeys() {
152 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
153 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
155 return Civi
::$statics[__CLASS__
]['fieldKeys'];
159 * Returns the names of this table
163 public static function getTableName() {
164 return self
::$_tableName;
168 * Returns if this table needs to be logged
172 public function getLog() {
177 * Returns the list of fields that can be imported
179 * @param bool $prefix
183 public static function &import($prefix = FALSE) {
184 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'event_carts', $prefix, []);
189 * Returns the list of fields that can be exported
191 * @param bool $prefix
195 public static function &export($prefix = FALSE) {
196 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'event_carts', $prefix, []);
201 * Returns the list of indices
203 * @param bool $localize
207 public static function indices($localize = TRUE) {
209 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;