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