Regenerate DAO files
[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:8bd26effd43fe4ee752addf11e6a4769)
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 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 'where' => 'civicrm_price_set_entity.id',
98 'table_name' => 'civicrm_price_set_entity',
99 'entity' => 'PriceSetEntity',
100 'bao' => 'CRM_Price_DAO_PriceSetEntity',
101 'localizable' => 0,
102 ],
103 'entity_table' => [
104 'name' => 'entity_table',
105 'type' => CRM_Utils_Type::T_STRING,
106 'title' => ts('Entity Table'),
107 'description' => ts('Table which uses this price set'),
108 'required' => TRUE,
109 'maxlength' => 64,
110 'size' => CRM_Utils_Type::BIG,
111 'where' => 'civicrm_price_set_entity.entity_table',
112 'table_name' => 'civicrm_price_set_entity',
113 'entity' => 'PriceSetEntity',
114 'bao' => 'CRM_Price_DAO_PriceSetEntity',
115 'localizable' => 0,
116 ],
117 'entity_id' => [
118 'name' => 'entity_id',
119 'type' => CRM_Utils_Type::T_INT,
120 'title' => ts('Entity IF'),
121 'description' => ts('Item in table'),
122 'required' => TRUE,
123 'where' => 'civicrm_price_set_entity.entity_id',
124 'table_name' => 'civicrm_price_set_entity',
125 'entity' => 'PriceSetEntity',
126 'bao' => 'CRM_Price_DAO_PriceSetEntity',
127 'localizable' => 0,
128 ],
129 'price_set_id' => [
130 'name' => 'price_set_id',
131 'type' => CRM_Utils_Type::T_INT,
132 'title' => ts('Price Set'),
133 'description' => ts('price set being used'),
134 'required' => TRUE,
135 'where' => 'civicrm_price_set_entity.price_set_id',
136 'table_name' => 'civicrm_price_set_entity',
137 'entity' => 'PriceSetEntity',
138 'bao' => 'CRM_Price_DAO_PriceSetEntity',
139 'localizable' => 0,
140 'FKClassName' => 'CRM_Price_DAO_PriceSet',
141 ],
142 ];
143 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
144 }
145 return Civi::$statics[__CLASS__]['fields'];
146 }
147
148 /**
149 * Return a mapping from field-name to the corresponding key (as used in fields()).
150 *
151 * @return array
152 * Array(string $name => string $uniqueName).
153 */
154 public static function &fieldKeys() {
155 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
156 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
157 }
158 return Civi::$statics[__CLASS__]['fieldKeys'];
159 }
160
161 /**
162 * Returns the names of this table
163 *
164 * @return string
165 */
166 public static function getTableName() {
167 return self::$_tableName;
168 }
169
170 /**
171 * Returns if this table needs to be logged
172 *
173 * @return bool
174 */
175 public function getLog() {
176 return self::$_log;
177 }
178
179 /**
180 * Returns the list of fields that can be imported
181 *
182 * @param bool $prefix
183 *
184 * @return array
185 */
186 public static function &import($prefix = FALSE) {
187 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set_entity', $prefix, []);
188 return $r;
189 }
190
191 /**
192 * Returns the list of fields that can be exported
193 *
194 * @param bool $prefix
195 *
196 * @return array
197 */
198 public static function &export($prefix = FALSE) {
199 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set_entity', $prefix, []);
200 return $r;
201 }
202
203 /**
204 * Returns the list of indices
205 *
206 * @param bool $localize
207 *
208 * @return array
209 */
210 public static function indices($localize = TRUE) {
211 $indices = [
212 'UI_entity' => [
213 'name' => 'UI_entity',
214 'field' => [
215 0 => 'entity_table',
216 1 => 'entity_id',
217 ],
218 'localizable' => FALSE,
219 'unique' => TRUE,
220 'sig' => 'civicrm_price_set_entity::1::entity_table::entity_id',
221 ],
222 ];
223 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
224 }
225
226 }