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