Merge pull request #22326 from totten/master-sqlpara
[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
2562d09a 9 * (GenCodeChecksum:0be314d066d9e72b66c86a2de6d681a9)
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 {
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 ],
1fe423d6 118 'readonly' => TRUE,
a9d0587b 119 'add' => '1.8',
c3fc2621
CW
120 ],
121 'entity_table' => [
e501603b
TO
122 'name' => 'entity_table',
123 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 124 'title' => ts('Entity Table'),
215b423e 125 'description' => ts('Table which uses this price set'),
c3fc2621 126 'required' => TRUE,
e501603b
TO
127 'maxlength' => 64,
128 'size' => CRM_Utils_Type::BIG,
a36434b9 129 'where' => 'civicrm_price_set_entity.entity_table',
522a26c9 130 'table_name' => 'civicrm_price_set_entity',
131 'entity' => 'PriceSetEntity',
132 'bao' => 'CRM_Price_DAO_PriceSetEntity',
6a7e5e5d 133 'localizable' => 0,
a9d0587b 134 'add' => '1.8',
c3fc2621
CW
135 ],
136 'entity_id' => [
e501603b
TO
137 'name' => 'entity_id',
138 'type' => CRM_Utils_Type::T_INT,
c3fc2621 139 'title' => ts('Entity IF'),
215b423e 140 'description' => ts('Item in table'),
c3fc2621 141 'required' => TRUE,
a36434b9 142 'where' => 'civicrm_price_set_entity.entity_id',
522a26c9 143 'table_name' => 'civicrm_price_set_entity',
144 'entity' => 'PriceSetEntity',
145 'bao' => 'CRM_Price_DAO_PriceSetEntity',
6a7e5e5d 146 'localizable' => 0,
a9d0587b 147 'add' => '1.8',
c3fc2621
CW
148 ],
149 'price_set_id' => [
e501603b
TO
150 'name' => 'price_set_id',
151 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 152 'title' => ts('Price Set ID'),
215b423e 153 'description' => ts('price set being used'),
c3fc2621 154 'required' => TRUE,
a36434b9 155 'where' => 'civicrm_price_set_entity.price_set_id',
522a26c9 156 'table_name' => 'civicrm_price_set_entity',
157 'entity' => 'PriceSetEntity',
158 'bao' => 'CRM_Price_DAO_PriceSetEntity',
6a7e5e5d 159 'localizable' => 0,
e501603b 160 'FKClassName' => 'CRM_Price_DAO_PriceSet',
2cbbebe8
A
161 'html' => [
162 'label' => ts("Price Set"),
163 ],
23df3503
PN
164 'pseudoconstant' => [
165 'table' => 'civicrm_price_set',
166 'keyColumn' => 'id',
167 'labelColumn' => 'title',
168 ],
a9d0587b 169 'add' => '1.8',
c3fc2621
CW
170 ],
171 ];
346aaaba 172 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 173 }
346aaaba 174 return Civi::$statics[__CLASS__]['fields'];
e501603b 175 }
c3fc2621 176
e501603b 177 /**
bd8e0b14 178 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
179 *
180 * @return array
bd8e0b14 181 * Array(string $name => string $uniqueName).
e501603b 182 */
c3fc2621 183 public static function &fieldKeys() {
bd8e0b14
TO
184 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
185 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 186 }
bd8e0b14 187 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 188 }
c3fc2621 189
e501603b
TO
190 /**
191 * Returns the names of this table
192 *
193 * @return string
194 */
c3fc2621 195 public static function getTableName() {
e501603b
TO
196 return self::$_tableName;
197 }
c3fc2621 198
e501603b
TO
199 /**
200 * Returns if this table needs to be logged
201 *
c3fc2621 202 * @return bool
e501603b 203 */
c3fc2621 204 public function getLog() {
e501603b
TO
205 return self::$_log;
206 }
c3fc2621 207
e501603b
TO
208 /**
209 * Returns the list of fields that can be imported
210 *
211 * @param bool $prefix
212 *
213 * @return array
214 */
c3fc2621
CW
215 public static function &import($prefix = FALSE) {
216 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set_entity', $prefix, []);
60808919 217 return $r;
e501603b 218 }
c3fc2621 219
e501603b
TO
220 /**
221 * Returns the list of fields that can be exported
222 *
223 * @param bool $prefix
224 *
225 * @return array
226 */
c3fc2621
CW
227 public static function &export($prefix = FALSE) {
228 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set_entity', $prefix, []);
60808919 229 return $r;
e501603b 230 }
c3fc2621 231
e7a6b91a
AS
232 /**
233 * Returns the list of indices
c3fc2621
CW
234 *
235 * @param bool $localize
236 *
237 * @return array
e7a6b91a
AS
238 */
239 public static function indices($localize = TRUE) {
c3fc2621
CW
240 $indices = [
241 'UI_entity' => [
e7a6b91a 242 'name' => 'UI_entity',
c3fc2621 243 'field' => [
e7a6b91a
AS
244 0 => 'entity_table',
245 1 => 'entity_id',
c3fc2621
CW
246 ],
247 'localizable' => FALSE,
248 'unique' => TRUE,
e7a6b91a 249 'sig' => 'civicrm_price_set_entity::1::entity_table::entity_id',
c3fc2621
CW
250 ],
251 ];
e7a6b91a
AS
252 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
253 }
c3fc2621 254
e501603b 255}