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