Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
06b69b18 | 4 | | CiviCRM version 4.5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06b69b18 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
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 | * | |
29 | * @package CRM | |
06b69b18 | 30 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
31 | * $Id$ |
32 | * | |
33 | */ | |
34 | require_once 'CRM/Core/DAO.php'; | |
35 | require_once 'CRM/Utils/Type.php'; | |
36 | class CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity extends CRM_Core_DAO | |
37 | { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | * @static | |
43 | */ | |
44 | static $_tableName = 'civicrm_price_set_entity'; | |
45 | /** | |
46 | * static instance to hold the field values | |
47 | * | |
48 | * @var array | |
49 | * @static | |
50 | */ | |
51 | static $_fields = null; | |
52 | /** | |
53 | * static instance to hold the FK relationships | |
54 | * | |
55 | * @var string | |
56 | * @static | |
57 | */ | |
58 | static $_links = null; | |
59 | /** | |
60 | * static instance to hold the values that can | |
61 | * be imported | |
62 | * | |
63 | * @var array | |
64 | * @static | |
65 | */ | |
66 | static $_import = null; | |
67 | /** | |
68 | * static instance to hold the values that can | |
69 | * be exported | |
70 | * | |
71 | * @var array | |
72 | * @static | |
73 | */ | |
74 | static $_export = null; | |
75 | /** | |
76 | * static value to see if we should log any modifications to | |
77 | * this table in the civicrm_log table | |
78 | * | |
79 | * @var boolean | |
80 | * @static | |
81 | */ | |
82 | static $_log = true; | |
83 | /** | |
84 | * Price Set Entity | |
85 | * | |
86 | * @var int unsigned | |
87 | */ | |
88 | public $id; | |
89 | /** | |
90 | * Table which uses this price set | |
91 | * | |
92 | * @var string | |
93 | */ | |
94 | public $entity_table; | |
95 | /** | |
96 | * Item in table | |
97 | * | |
98 | * @var int unsigned | |
99 | */ | |
100 | public $entity_id; | |
101 | /** | |
102 | * price set being used | |
103 | * | |
104 | * @var int unsigned | |
105 | */ | |
106 | public $price_set_id; | |
77b97be7 EM |
107 | |
108 | /** | |
109 | * class constructor | |
110 | * | |
111 | * @access public | |
112 | * @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity | |
113 | */ | |
6a488035 TO |
114 | function __construct() |
115 | { | |
116 | $this->__table = 'civicrm_price_set_entity'; | |
117 | parent::__construct(); | |
118 | } | |
119 | /** | |
120 | * return foreign links | |
121 | * | |
122 | * @access public | |
123 | * @return array | |
124 | */ | |
125 | function links() | |
126 | { | |
127 | if (!(self::$_links)) { | |
128 | self::$_links = array( | |
129 | 'price_set_id' => 'civicrm_price_set:id', | |
130 | ); | |
131 | } | |
132 | return self::$_links; | |
133 | } | |
134 | /** | |
135 | * returns all the column names of this table | |
136 | * | |
137 | * @access public | |
138 | * @return array | |
139 | */ | |
140 | static function &fields() | |
141 | { | |
142 | if (!(self::$_fields)) { | |
143 | self::$_fields = array( | |
144 | 'id' => array( | |
145 | 'name' => 'id', | |
146 | 'type' => CRM_Utils_Type::T_INT, | |
147 | 'required' => true, | |
148 | ) , | |
149 | 'entity_table' => array( | |
150 | 'name' => 'entity_table', | |
151 | 'type' => CRM_Utils_Type::T_STRING, | |
152 | 'title' => ts('Entity Table') , | |
153 | 'required' => true, | |
154 | 'maxlength' => 64, | |
155 | 'size' => CRM_Utils_Type::BIG, | |
156 | ) , | |
157 | 'entity_id' => array( | |
158 | 'name' => 'entity_id', | |
159 | 'type' => CRM_Utils_Type::T_INT, | |
160 | 'required' => true, | |
161 | ) , | |
162 | 'price_set_id' => array( | |
163 | 'name' => 'price_set_id', | |
164 | 'type' => CRM_Utils_Type::T_INT, | |
165 | 'required' => true, | |
166 | 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Set', | |
167 | ) , | |
168 | ); | |
169 | } | |
170 | return self::$_fields; | |
171 | } | |
172 | /** | |
173 | * returns the names of this table | |
174 | * | |
175 | * @access public | |
176 | * @static | |
177 | * @return string | |
178 | */ | |
179 | static function getTableName() | |
180 | { | |
181 | return self::$_tableName; | |
182 | } | |
183 | /** | |
184 | * returns if this table needs to be logged | |
185 | * | |
186 | * @access public | |
187 | * @return boolean | |
188 | */ | |
189 | function getLog() | |
190 | { | |
191 | return self::$_log; | |
192 | } | |
193 | /** | |
194 | * returns the list of fields that can be imported | |
195 | * | |
196 | * @access public | |
197 | * return array | |
198 | * @static | |
199 | */ | |
200 | static function &import($prefix = false) | |
201 | { | |
202 | if (!(self::$_import)) { | |
203 | self::$_import = array(); | |
204 | $fields = self::fields(); | |
205 | foreach($fields as $name => $field) { | |
a7488080 | 206 | if (!empty($field['import'])) { |
6a488035 TO |
207 | if ($prefix) { |
208 | self::$_import['price_set_entity'] = & $fields[$name]; | |
209 | } else { | |
210 | self::$_import[$name] = & $fields[$name]; | |
211 | } | |
212 | } | |
213 | } | |
214 | } | |
215 | return self::$_import; | |
216 | } | |
217 | /** | |
218 | * returns the list of fields that can be exported | |
219 | * | |
220 | * @access public | |
221 | * return array | |
222 | * @static | |
223 | */ | |
224 | static function &export($prefix = false) | |
225 | { | |
226 | if (!(self::$_export)) { | |
227 | self::$_export = array(); | |
228 | $fields = self::fields(); | |
229 | foreach($fields as $name => $field) { | |
a7488080 | 230 | if (!empty($field['export'])) { |
6a488035 TO |
231 | if ($prefix) { |
232 | self::$_export['price_set_entity'] = & $fields[$name]; | |
233 | } else { | |
234 | self::$_export[$name] = & $fields[$name]; | |
235 | } | |
236 | } | |
237 | } | |
238 | } | |
239 | return self::$_export; | |
240 | } | |
241 | } |