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