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