Translate description in DAO files
[civicrm-core.git] / CRM / Core / DAO / Discount.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/Discount.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e7a6b91a 9 * (GenCodeChecksum:1ce69428f948066567e95645cb86254a)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Discount entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_Discount 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_discount';
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 * primary key
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * physical tablename for entity being joined to discount, e.g. civicrm_event
40 *
41 * @var string
42 */
43 public $entity_table;
c3fc2621 44
e501603b
TO
45 /**
46 * FK to entity table specified in entity_table column.
47 *
48 * @var int unsigned
49 */
50 public $entity_id;
c3fc2621 51
e501603b
TO
52 /**
53 * FK to civicrm_price_set
54 *
55 * @var int unsigned
56 */
57 public $price_set_id;
c3fc2621 58
e501603b
TO
59 /**
60 * Date when discount starts.
61 *
62 * @var date
63 */
64 public $start_date;
c3fc2621 65
e501603b
TO
66 /**
67 * Date when discount ends.
68 *
69 * @var date
70 */
71 public $end_date;
c3fc2621 72
e501603b 73 /**
f41f0342 74 * Class constructor.
e501603b 75 */
c3fc2621 76 public function __construct() {
e501603b
TO
77 $this->__table = 'civicrm_discount';
78 parent::__construct();
79 }
c3fc2621 80
e501603b 81 /**
f41f0342 82 * Returns foreign keys and entity references.
e501603b
TO
83 *
84 * @return array
85 * [CRM_Core_Reference_Interface]
86 */
c3fc2621 87 public static function getReferenceColumns() {
346aaaba
TO
88 if (!isset(Civi::$statics[__CLASS__]['links'])) {
89 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
c3fc2621
CW
90 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_set_id', 'civicrm_price_set', 'id');
91 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 92 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 93 }
346aaaba 94 return Civi::$statics[__CLASS__]['links'];
e501603b 95 }
c3fc2621 96
e501603b
TO
97 /**
98 * Returns all the column names of this table
99 *
100 * @return array
101 */
c3fc2621 102 public static function &fields() {
346aaaba 103 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
104 Civi::$statics[__CLASS__]['fields'] = [
105 'id' => [
e501603b
TO
106 'name' => 'id',
107 'type' => CRM_Utils_Type::T_INT,
c3fc2621 108 'title' => ts('Discount ID'),
215b423e 109 'description' => ts('primary key'),
c3fc2621 110 'required' => TRUE,
522a26c9 111 'table_name' => 'civicrm_discount',
112 'entity' => 'Discount',
113 'bao' => 'CRM_Core_BAO_Discount',
6a7e5e5d 114 'localizable' => 0,
c3fc2621
CW
115 ],
116 'entity_table' => [
e501603b
TO
117 'name' => 'entity_table',
118 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 119 'title' => ts('Entity Table'),
215b423e 120 'description' => ts('physical tablename for entity being joined to discount, e.g. civicrm_event'),
e501603b
TO
121 'maxlength' => 64,
122 'size' => CRM_Utils_Type::BIG,
522a26c9 123 'table_name' => 'civicrm_discount',
124 'entity' => 'Discount',
125 'bao' => 'CRM_Core_BAO_Discount',
6a7e5e5d 126 'localizable' => 0,
c3fc2621
CW
127 ],
128 'entity_id' => [
e501603b
TO
129 'name' => 'entity_id',
130 'type' => CRM_Utils_Type::T_INT,
c3fc2621 131 'title' => ts('Entity ID'),
215b423e 132 'description' => ts('FK to entity table specified in entity_table column.'),
c3fc2621 133 'required' => TRUE,
522a26c9 134 'table_name' => 'civicrm_discount',
135 'entity' => 'Discount',
136 'bao' => 'CRM_Core_BAO_Discount',
6a7e5e5d 137 'localizable' => 0,
c3fc2621
CW
138 ],
139 'participant_discount_name' => [
e501603b
TO
140 'name' => 'price_set_id',
141 'type' => CRM_Utils_Type::T_INT,
c3fc2621 142 'title' => ts('Discount Name'),
215b423e 143 'description' => ts('FK to civicrm_price_set'),
c3fc2621
CW
144 'required' => TRUE,
145 'export' => TRUE,
e501603b
TO
146 'where' => 'civicrm_discount.price_set_id',
147 'headerPattern' => '',
148 'dataPattern' => '',
522a26c9 149 'table_name' => 'civicrm_discount',
150 'entity' => 'Discount',
151 'bao' => 'CRM_Core_BAO_Discount',
6a7e5e5d 152 'localizable' => 0,
e501603b 153 'FKClassName' => 'CRM_Price_DAO_PriceSet',
c3fc2621
CW
154 ],
155 'start_date' => [
e501603b
TO
156 'name' => 'start_date',
157 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 158 'title' => ts('Discount Start Date'),
215b423e 159 'description' => ts('Date when discount starts.'),
522a26c9 160 'table_name' => 'civicrm_discount',
161 'entity' => 'Discount',
162 'bao' => 'CRM_Core_BAO_Discount',
6a7e5e5d 163 'localizable' => 0,
c3fc2621
CW
164 ],
165 'end_date' => [
e501603b
TO
166 'name' => 'end_date',
167 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 168 'title' => ts('Discount End Date'),
215b423e 169 'description' => ts('Date when discount ends.'),
522a26c9 170 'table_name' => 'civicrm_discount',
171 'entity' => 'Discount',
172 'bao' => 'CRM_Core_BAO_Discount',
6a7e5e5d 173 'localizable' => 0,
c3fc2621
CW
174 ],
175 ];
346aaaba 176 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 177 }
346aaaba 178 return Civi::$statics[__CLASS__]['fields'];
e501603b 179 }
c3fc2621 180
e501603b 181 /**
bd8e0b14 182 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
183 *
184 * @return array
bd8e0b14 185 * Array(string $name => string $uniqueName).
e501603b 186 */
c3fc2621 187 public static function &fieldKeys() {
bd8e0b14
TO
188 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
189 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 190 }
bd8e0b14 191 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 192 }
c3fc2621 193
e501603b
TO
194 /**
195 * Returns the names of this table
196 *
197 * @return string
198 */
c3fc2621 199 public static function getTableName() {
e501603b
TO
200 return self::$_tableName;
201 }
c3fc2621 202
e501603b
TO
203 /**
204 * Returns if this table needs to be logged
205 *
c3fc2621 206 * @return bool
e501603b 207 */
c3fc2621 208 public function getLog() {
e501603b
TO
209 return self::$_log;
210 }
c3fc2621 211
e501603b
TO
212 /**
213 * Returns the list of fields that can be imported
214 *
215 * @param bool $prefix
216 *
217 * @return array
218 */
c3fc2621
CW
219 public static function &import($prefix = FALSE) {
220 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'discount', $prefix, []);
60808919 221 return $r;
e501603b 222 }
c3fc2621 223
e501603b
TO
224 /**
225 * Returns the list of fields that can be exported
226 *
227 * @param bool $prefix
228 *
229 * @return array
230 */
c3fc2621
CW
231 public static function &export($prefix = FALSE) {
232 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'discount', $prefix, []);
60808919 233 return $r;
e501603b 234 }
c3fc2621 235
e7a6b91a
AS
236 /**
237 * Returns the list of indices
c3fc2621
CW
238 *
239 * @param bool $localize
240 *
241 * @return array
e7a6b91a
AS
242 */
243 public static function indices($localize = TRUE) {
c3fc2621
CW
244 $indices = [
245 'index_entity' => [
e7a6b91a 246 'name' => 'index_entity',
c3fc2621 247 'field' => [
e7a6b91a
AS
248 0 => 'entity_table',
249 1 => 'entity_id',
c3fc2621
CW
250 ],
251 'localizable' => FALSE,
e7a6b91a 252 'sig' => 'civicrm_discount::0::entity_table::entity_id',
c3fc2621
CW
253 ],
254 'index_entity_option_id' => [
e7a6b91a 255 'name' => 'index_entity_option_id',
c3fc2621 256 'field' => [
e7a6b91a
AS
257 0 => 'entity_table',
258 1 => 'entity_id',
259 2 => 'price_set_id',
c3fc2621
CW
260 ],
261 'localizable' => FALSE,
e7a6b91a 262 'sig' => 'civicrm_discount::0::entity_table::entity_id::price_set_id',
c3fc2621
CW
263 ],
264 ];
e7a6b91a
AS
265 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
266 }
c3fc2621 267
e501603b 268}