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