0bef5929d79bb523bfaf4b3e81ae59e1ce852bfb
[civicrm-core.git] / CRM / Price / DAO / PriceSetEntity.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Price/PriceSetEntity.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ba2a78bcd5c6c34e2a81d1bcef776ca3)
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 unsigned
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 unsigned
49 */
50 public $entity_id;
51
52 /**
53 * price set being used
54 *
55 * @var int unsigned
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 foreign keys and entity references.
69 *
70 * @return array
71 * [CRM_Core_Reference_Interface]
72 */
73 public static function getReferenceColumns() {
74 if (!isset(Civi::$statics[__CLASS__]['links'])) {
75 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
76 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_set_id', 'civicrm_price_set', 'id');
77 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
78 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
79 }
80 return Civi::$statics[__CLASS__]['links'];
81 }
82
83 /**
84 * Returns all the column names of this table
85 *
86 * @return array
87 */
88 public static function &fields() {
89 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
90 Civi::$statics[__CLASS__]['fields'] = [
91 'id' => [
92 'name' => 'id',
93 'type' => CRM_Utils_Type::T_INT,
94 'title' => ts('Price Set Entity ID'),
95 'description' => ts('Price Set Entity'),
96 'required' => TRUE,
97 'table_name' => 'civicrm_price_set_entity',
98 'entity' => 'PriceSetEntity',
99 'bao' => 'CRM_Price_DAO_PriceSetEntity',
100 'localizable' => 0,
101 ],
102 'entity_table' => [
103 'name' => 'entity_table',
104 'type' => CRM_Utils_Type::T_STRING,
105 'title' => ts('Entity Table'),
106 'description' => ts('Table which uses this price set'),
107 'required' => TRUE,
108 'maxlength' => 64,
109 'size' => CRM_Utils_Type::BIG,
110 'table_name' => 'civicrm_price_set_entity',
111 'entity' => 'PriceSetEntity',
112 'bao' => 'CRM_Price_DAO_PriceSetEntity',
113 'localizable' => 0,
114 ],
115 'entity_id' => [
116 'name' => 'entity_id',
117 'type' => CRM_Utils_Type::T_INT,
118 'title' => ts('Entity IF'),
119 'description' => ts('Item in table'),
120 'required' => TRUE,
121 'table_name' => 'civicrm_price_set_entity',
122 'entity' => 'PriceSetEntity',
123 'bao' => 'CRM_Price_DAO_PriceSetEntity',
124 'localizable' => 0,
125 ],
126 'price_set_id' => [
127 'name' => 'price_set_id',
128 'type' => CRM_Utils_Type::T_INT,
129 'title' => ts('Price Set'),
130 'description' => ts('price set being used'),
131 'required' => TRUE,
132 'table_name' => 'civicrm_price_set_entity',
133 'entity' => 'PriceSetEntity',
134 'bao' => 'CRM_Price_DAO_PriceSetEntity',
135 'localizable' => 0,
136 'FKClassName' => 'CRM_Price_DAO_PriceSet',
137 ],
138 ];
139 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
140 }
141 return Civi::$statics[__CLASS__]['fields'];
142 }
143
144 /**
145 * Return a mapping from field-name to the corresponding key (as used in fields()).
146 *
147 * @return array
148 * Array(string $name => string $uniqueName).
149 */
150 public static function &fieldKeys() {
151 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
152 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
153 }
154 return Civi::$statics[__CLASS__]['fieldKeys'];
155 }
156
157 /**
158 * Returns the names of this table
159 *
160 * @return string
161 */
162 public static function getTableName() {
163 return self::$_tableName;
164 }
165
166 /**
167 * Returns if this table needs to be logged
168 *
169 * @return bool
170 */
171 public function getLog() {
172 return self::$_log;
173 }
174
175 /**
176 * Returns the list of fields that can be imported
177 *
178 * @param bool $prefix
179 *
180 * @return array
181 */
182 public static function &import($prefix = FALSE) {
183 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set_entity', $prefix, []);
184 return $r;
185 }
186
187 /**
188 * Returns the list of fields that can be exported
189 *
190 * @param bool $prefix
191 *
192 * @return array
193 */
194 public static function &export($prefix = FALSE) {
195 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set_entity', $prefix, []);
196 return $r;
197 }
198
199 /**
200 * Returns the list of indices
201 *
202 * @param bool $localize
203 *
204 * @return array
205 */
206 public static function indices($localize = TRUE) {
207 $indices = [
208 'UI_entity' => [
209 'name' => 'UI_entity',
210 'field' => [
211 0 => 'entity_table',
212 1 => 'entity_id',
213 ],
214 'localizable' => FALSE,
215 'unique' => TRUE,
216 'sig' => 'civicrm_price_set_entity::1::entity_table::entity_id',
217 ],
218 ];
219 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
220 }
221
222 }