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