API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Price / DAO / PriceSetEntity.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Price/PriceSetEntity.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a37bda1a3508a9195c561c2b2e4f03a7)
10 */
11
12 /**
13 * Database access object for the PriceSetEntity entity.
14 */
15 class CRM_Price_DAO_PriceSetEntity extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_price_set_entity';
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 = TRUE;
30
31 /**
32 * Price Set Entity
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Table which uses this price set
40 *
41 * @var string
42 */
43 public $entity_table;
44
45 /**
46 * Item in table
47 *
48 * @var int
49 */
50 public $entity_id;
51
52 /**
53 * price set being used
54 *
55 * @var int
56 */
57 public $price_set_id;
58
59 /**
60 * Class constructor.
61 */
62 public function __construct() {
63 $this->__table = 'civicrm_price_set_entity';
64 parent::__construct();
65 }
66
67 /**
68 * Returns localized title of this entity.
69 */
70 public static function getEntityTitle() {
71 return ts('Price Set Entities');
72 }
73
74 /**
75 * Returns foreign keys and entity references.
76 *
77 * @return array
78 * [CRM_Core_Reference_Interface]
79 */
80 public static function getReferenceColumns() {
81 if (!isset(Civi::$statics[__CLASS__]['links'])) {
82 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
83 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_set_id', 'civicrm_price_set', 'id');
84 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
85 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
86 }
87 return Civi::$statics[__CLASS__]['links'];
88 }
89
90 /**
91 * Returns all the column names of this table
92 *
93 * @return array
94 */
95 public static function &fields() {
96 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
97 Civi::$statics[__CLASS__]['fields'] = [
98 'id' => [
99 'name' => 'id',
100 'type' => CRM_Utils_Type::T_INT,
101 'title' => ts('Price Set Entity ID'),
102 'description' => ts('Price Set Entity'),
103 'required' => TRUE,
104 'where' => 'civicrm_price_set_entity.id',
105 'table_name' => 'civicrm_price_set_entity',
106 'entity' => 'PriceSetEntity',
107 'bao' => 'CRM_Price_DAO_PriceSetEntity',
108 'localizable' => 0,
109 'add' => '1.8',
110 ],
111 'entity_table' => [
112 'name' => 'entity_table',
113 'type' => CRM_Utils_Type::T_STRING,
114 'title' => ts('Entity Table'),
115 'description' => ts('Table which uses this price set'),
116 'required' => TRUE,
117 'maxlength' => 64,
118 'size' => CRM_Utils_Type::BIG,
119 'where' => 'civicrm_price_set_entity.entity_table',
120 'table_name' => 'civicrm_price_set_entity',
121 'entity' => 'PriceSetEntity',
122 'bao' => 'CRM_Price_DAO_PriceSetEntity',
123 'localizable' => 0,
124 'add' => '1.8',
125 ],
126 'entity_id' => [
127 'name' => 'entity_id',
128 'type' => CRM_Utils_Type::T_INT,
129 'title' => ts('Entity IF'),
130 'description' => ts('Item in table'),
131 'required' => TRUE,
132 'where' => 'civicrm_price_set_entity.entity_id',
133 'table_name' => 'civicrm_price_set_entity',
134 'entity' => 'PriceSetEntity',
135 'bao' => 'CRM_Price_DAO_PriceSetEntity',
136 'localizable' => 0,
137 'add' => '1.8',
138 ],
139 'price_set_id' => [
140 'name' => 'price_set_id',
141 'type' => CRM_Utils_Type::T_INT,
142 'title' => ts('Price Set'),
143 'description' => ts('price set being used'),
144 'required' => TRUE,
145 'where' => 'civicrm_price_set_entity.price_set_id',
146 'table_name' => 'civicrm_price_set_entity',
147 'entity' => 'PriceSetEntity',
148 'bao' => 'CRM_Price_DAO_PriceSetEntity',
149 'localizable' => 0,
150 'FKClassName' => 'CRM_Price_DAO_PriceSet',
151 'pseudoconstant' => [
152 'table' => 'civicrm_price_set',
153 'keyColumn' => 'id',
154 'labelColumn' => 'title',
155 ],
156 'add' => '1.8',
157 ],
158 ];
159 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
160 }
161 return Civi::$statics[__CLASS__]['fields'];
162 }
163
164 /**
165 * Return a mapping from field-name to the corresponding key (as used in fields()).
166 *
167 * @return array
168 * Array(string $name => string $uniqueName).
169 */
170 public static function &fieldKeys() {
171 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
172 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
173 }
174 return Civi::$statics[__CLASS__]['fieldKeys'];
175 }
176
177 /**
178 * Returns the names of this table
179 *
180 * @return string
181 */
182 public static function getTableName() {
183 return self::$_tableName;
184 }
185
186 /**
187 * Returns if this table needs to be logged
188 *
189 * @return bool
190 */
191 public function getLog() {
192 return self::$_log;
193 }
194
195 /**
196 * Returns the list of fields that can be imported
197 *
198 * @param bool $prefix
199 *
200 * @return array
201 */
202 public static function &import($prefix = FALSE) {
203 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set_entity', $prefix, []);
204 return $r;
205 }
206
207 /**
208 * Returns the list of fields that can be exported
209 *
210 * @param bool $prefix
211 *
212 * @return array
213 */
214 public static function &export($prefix = FALSE) {
215 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set_entity', $prefix, []);
216 return $r;
217 }
218
219 /**
220 * Returns the list of indices
221 *
222 * @param bool $localize
223 *
224 * @return array
225 */
226 public static function indices($localize = TRUE) {
227 $indices = [
228 'UI_entity' => [
229 'name' => 'UI_entity',
230 'field' => [
231 0 => 'entity_table',
232 1 => 'entity_id',
233 ],
234 'localizable' => FALSE,
235 'unique' => TRUE,
236 'sig' => 'civicrm_price_set_entity::1::entity_table::entity_id',
237 ],
238 ];
239 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
240 }
241
242 }