Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2016 | | |
7 | +--------------------------------------------------------------------+ | |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | /** | |
28 | * @package CRM | |
29 | * @copyright CiviCRM LLC (c) 2004-2016 | |
30 | * | |
31 | * Generated from xml/schema/CRM/Contribute/PremiumsProduct.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:3580529cebca0659c28e8d4f55015c22) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Contribute_DAO_PremiumsProduct extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_premiums_product'; | |
44 | /** | |
45 | * static instance to hold the field values | |
46 | * | |
47 | * @var array | |
48 | */ | |
49 | static $_fields = null; | |
50 | /** | |
51 | * static instance to hold the keys used in $_fields for each field. | |
52 | * | |
53 | * @var array | |
54 | */ | |
55 | static $_fieldKeys = null; | |
56 | /** | |
57 | * static instance to hold the FK relationships | |
58 | * | |
59 | * @var string | |
60 | */ | |
61 | static $_links = null; | |
62 | /** | |
63 | * static instance to hold the values that can | |
64 | * be imported | |
65 | * | |
66 | * @var array | |
67 | */ | |
68 | static $_import = null; | |
69 | /** | |
70 | * static instance to hold the values that can | |
71 | * be exported | |
72 | * | |
73 | * @var array | |
74 | */ | |
75 | static $_export = null; | |
76 | /** | |
77 | * static value to see if we should log any modifications to | |
78 | * this table in the civicrm_log table | |
79 | * | |
80 | * @var boolean | |
81 | */ | |
82 | static $_log = true; | |
83 | /** | |
84 | * Contribution ID | |
85 | * | |
86 | * @var int unsigned | |
87 | */ | |
88 | public $id; | |
89 | /** | |
90 | * Foreign key to premiums settings record. | |
91 | * | |
92 | * @var int unsigned | |
93 | */ | |
94 | public $premiums_id; | |
95 | /** | |
96 | * Foreign key to each product object. | |
97 | * | |
98 | * @var int unsigned | |
99 | */ | |
100 | public $product_id; | |
101 | /** | |
102 | * | |
103 | * @var int unsigned | |
104 | */ | |
105 | public $weight; | |
106 | /** | |
107 | * FK to Financial Type. | |
108 | * | |
109 | * @var int unsigned | |
110 | */ | |
111 | public $financial_type_id; | |
112 | /** | |
113 | * class constructor | |
114 | * | |
115 | * @return civicrm_premiums_product | |
116 | */ | |
117 | function __construct() { | |
118 | $this->__table = 'civicrm_premiums_product'; | |
119 | parent::__construct(); | |
120 | } | |
121 | /** | |
122 | * Returns foreign keys and entity references | |
123 | * | |
124 | * @return array | |
125 | * [CRM_Core_Reference_Interface] | |
126 | */ | |
127 | static function getReferenceColumns() { | |
128 | if (!self::$_links) { | |
129 | self::$_links = static ::createReferenceColumns(__CLASS__); | |
130 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'premiums_id', 'civicrm_premiums', 'id'); | |
131 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'product_id', 'civicrm_product', 'id'); | |
132 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); | |
133 | } | |
134 | return self::$_links; | |
135 | } | |
136 | /** | |
137 | * Returns all the column names of this table | |
138 | * | |
139 | * @return array | |
140 | */ | |
141 | static function &fields() { | |
142 | if (!(self::$_fields)) { | |
143 | self::$_fields = array( | |
144 | 'id' => array( | |
145 | 'name' => 'id', | |
146 | 'type' => CRM_Utils_Type::T_INT, | |
147 | 'title' => ts('Premium Product ID') , | |
148 | 'description' => 'Contribution ID', | |
149 | 'required' => true, | |
150 | ) , | |
151 | 'premiums_id' => array( | |
152 | 'name' => 'premiums_id', | |
153 | 'type' => CRM_Utils_Type::T_INT, | |
154 | 'title' => ts('Premium') , | |
155 | 'description' => 'Foreign key to premiums settings record.', | |
156 | 'required' => true, | |
157 | 'FKClassName' => 'CRM_Contribute_DAO_Premium', | |
158 | ) , | |
159 | 'product_id' => array( | |
160 | 'name' => 'product_id', | |
161 | 'type' => CRM_Utils_Type::T_INT, | |
162 | 'title' => ts('Product') , | |
163 | 'description' => 'Foreign key to each product object.', | |
164 | 'required' => true, | |
165 | 'FKClassName' => 'CRM_Contribute_DAO_Product', | |
166 | ) , | |
167 | 'weight' => array( | |
168 | 'name' => 'weight', | |
169 | 'type' => CRM_Utils_Type::T_INT, | |
170 | 'title' => ts('Order') , | |
171 | 'required' => true, | |
172 | ) , | |
173 | 'financial_type_id' => array( | |
174 | 'name' => 'financial_type_id', | |
175 | 'type' => CRM_Utils_Type::T_INT, | |
176 | 'title' => ts('Financial Type') , | |
177 | 'description' => 'FK to Financial Type.', | |
178 | 'default' => 'NULL', | |
179 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', | |
180 | 'pseudoconstant' => array( | |
181 | 'table' => 'civicrm_financial_type', | |
182 | 'keyColumn' => 'id', | |
183 | 'labelColumn' => 'name', | |
184 | ) | |
185 | ) , | |
186 | ); | |
187 | } | |
188 | return self::$_fields; | |
189 | } | |
190 | /** | |
191 | * Returns an array containing, for each field, the arary key used for that | |
192 | * field in self::$_fields. | |
193 | * | |
194 | * @return array | |
195 | */ | |
196 | static function &fieldKeys() { | |
197 | if (!(self::$_fieldKeys)) { | |
198 | self::$_fieldKeys = array( | |
199 | 'id' => 'id', | |
200 | 'premiums_id' => 'premiums_id', | |
201 | 'product_id' => 'product_id', | |
202 | 'weight' => 'weight', | |
203 | 'financial_type_id' => 'financial_type_id', | |
204 | ); | |
205 | } | |
206 | return self::$_fieldKeys; | |
207 | } | |
208 | /** | |
209 | * Returns the names of this table | |
210 | * | |
211 | * @return string | |
212 | */ | |
213 | static function getTableName() { | |
214 | return self::$_tableName; | |
215 | } | |
216 | /** | |
217 | * Returns if this table needs to be logged | |
218 | * | |
219 | * @return boolean | |
220 | */ | |
221 | function getLog() { | |
222 | return self::$_log; | |
223 | } | |
224 | /** | |
225 | * Returns the list of fields that can be imported | |
226 | * | |
227 | * @param bool $prefix | |
228 | * | |
229 | * @return array | |
230 | */ | |
231 | static function &import($prefix = false) { | |
232 | if (!(self::$_import)) { | |
233 | self::$_import = array(); | |
234 | $fields = self::fields(); | |
235 | foreach($fields as $name => $field) { | |
236 | if (CRM_Utils_Array::value('import', $field)) { | |
237 | if ($prefix) { | |
238 | self::$_import['premiums_product'] = & $fields[$name]; | |
239 | } else { | |
240 | self::$_import[$name] = & $fields[$name]; | |
241 | } | |
242 | } | |
243 | } | |
244 | } | |
245 | return self::$_import; | |
246 | } | |
247 | /** | |
248 | * Returns the list of fields that can be exported | |
249 | * | |
250 | * @param bool $prefix | |
251 | * | |
252 | * @return array | |
253 | */ | |
254 | static function &export($prefix = false) { | |
255 | if (!(self::$_export)) { | |
256 | self::$_export = array(); | |
257 | $fields = self::fields(); | |
258 | foreach($fields as $name => $field) { | |
259 | if (CRM_Utils_Array::value('export', $field)) { | |
260 | if ($prefix) { | |
261 | self::$_export['premiums_product'] = & $fields[$name]; | |
262 | } else { | |
263 | self::$_export[$name] = & $fields[$name]; | |
264 | } | |
265 | } | |
266 | } | |
267 | } | |
268 | return self::$_export; | |
269 | } | |
270 | } |