DAOs with singular/plural options for entity titles
[civicrm-core.git] / CRM / Event / Cart / DAO / EventInCart.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/EventInCart.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ef07999cbb7872dc9c1cfa6a0055bee1)
10 */
11
12 /**
13 * Database access object for the EventInCart entity.
14 */
15 class CRM_Event_Cart_DAO_EventInCart extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_events_in_carts';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * Event In Cart Id
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * FK to Event ID
42 *
43 * @var int
44 */
45 public $event_id;
46
47 /**
48 * FK to Event Cart ID
49 *
50 * @var int
51 */
52 public $event_cart_id;
53
54 /**
55 * Class constructor.
56 */
57 public function __construct() {
58 $this->__table = 'civicrm_events_in_carts';
59 parent::__construct();
60 }
61
62 /**
63 * Returns localized title of this entity.
64 *
65 * @param bool $plural
66 * Whether to return the plural version of the title.
67 */
68 public static function getEntityTitle($plural = FALSE) {
69 return $plural ? ts('Event In Carts') : ts('Event In Cart');
70 }
71
72 /**
73 * Returns foreign keys and entity references.
74 *
75 * @return array
76 * [CRM_Core_Reference_Interface]
77 */
78 public static function getReferenceColumns() {
79 if (!isset(Civi::$statics[__CLASS__]['links'])) {
80 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
81 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_id', 'civicrm_event', 'id');
82 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_cart_id', 'civicrm_event_carts', 'id');
83 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
84 }
85 return Civi::$statics[__CLASS__]['links'];
86 }
87
88 /**
89 * Returns all the column names of this table
90 *
91 * @return array
92 */
93 public static function &fields() {
94 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
95 Civi::$statics[__CLASS__]['fields'] = [
96 'event_in_cart_id' => [
97 'name' => 'id',
98 'type' => CRM_Utils_Type::T_INT,
99 'title' => ts('Event In Cart'),
100 'description' => ts('Event In Cart Id'),
101 'required' => TRUE,
102 'where' => 'civicrm_events_in_carts.id',
103 'table_name' => 'civicrm_events_in_carts',
104 'entity' => 'EventInCart',
105 'bao' => 'CRM_Event_Cart_BAO_EventInCart',
106 'localizable' => 0,
107 'add' => '4.1',
108 ],
109 'event_id' => [
110 'name' => 'event_id',
111 'type' => CRM_Utils_Type::T_INT,
112 'title' => ts('Event'),
113 'description' => ts('FK to Event ID'),
114 'where' => 'civicrm_events_in_carts.event_id',
115 'table_name' => 'civicrm_events_in_carts',
116 'entity' => 'EventInCart',
117 'bao' => 'CRM_Event_Cart_BAO_EventInCart',
118 'localizable' => 0,
119 'FKClassName' => 'CRM_Event_DAO_Event',
120 'add' => '4.1',
121 ],
122 'event_cart_id' => [
123 'name' => 'event_cart_id',
124 'type' => CRM_Utils_Type::T_INT,
125 'title' => ts('Event In Cart'),
126 'description' => ts('FK to Event Cart ID'),
127 'where' => 'civicrm_events_in_carts.event_cart_id',
128 'table_name' => 'civicrm_events_in_carts',
129 'entity' => 'EventInCart',
130 'bao' => 'CRM_Event_Cart_BAO_EventInCart',
131 'localizable' => 0,
132 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
133 'add' => '4.1',
134 ],
135 ];
136 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
137 }
138 return Civi::$statics[__CLASS__]['fields'];
139 }
140
141 /**
142 * Return a mapping from field-name to the corresponding key (as used in fields()).
143 *
144 * @return array
145 * Array(string $name => string $uniqueName).
146 */
147 public static function &fieldKeys() {
148 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
149 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
150 }
151 return Civi::$statics[__CLASS__]['fieldKeys'];
152 }
153
154 /**
155 * Returns the names of this table
156 *
157 * @return string
158 */
159 public static function getTableName() {
160 return self::$_tableName;
161 }
162
163 /**
164 * Returns if this table needs to be logged
165 *
166 * @return bool
167 */
168 public function getLog() {
169 return self::$_log;
170 }
171
172 /**
173 * Returns the list of fields that can be imported
174 *
175 * @param bool $prefix
176 *
177 * @return array
178 */
179 public static function &import($prefix = FALSE) {
180 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'events_in_carts', $prefix, []);
181 return $r;
182 }
183
184 /**
185 * Returns the list of fields that can be exported
186 *
187 * @param bool $prefix
188 *
189 * @return array
190 */
191 public static function &export($prefix = FALSE) {
192 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'events_in_carts', $prefix, []);
193 return $r;
194 }
195
196 /**
197 * Returns the list of indices
198 *
199 * @param bool $localize
200 *
201 * @return array
202 */
203 public static function indices($localize = TRUE) {
204 $indices = [];
205 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
206 }
207
208 }