CRM/Upgrade add missing comment blocks
[civicrm-core.git] / CRM / Upgrade / Snapshot / V4p2 / Price / DAO / SetEntity.php
CommitLineData
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 */
34require_once 'CRM/Core/DAO.php';
35require_once 'CRM/Utils/Type.php';
624e56fa
EM
36
37/**
38 * Class CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity
39 */
6a488035
TO
40class 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;
77b97be7
EM
111
112 /**
113 * class constructor
114 *
115 * @access public
116 * @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity
117 */
6a488035
TO
118 function __construct()
119 {
120 $this->__table = 'civicrm_price_set_entity';
121 parent::__construct();
122 }
123 /**
124 * return foreign links
125 *
126 * @access public
127 * @return array
128 */
129 function links()
130 {
131 if (!(self::$_links)) {
132 self::$_links = array(
133 'price_set_id' => 'civicrm_price_set:id',
134 );
135 }
136 return self::$_links;
137 }
138 /**
139 * returns all the column names of this table
140 *
141 * @access public
142 * @return array
143 */
144 static function &fields()
145 {
146 if (!(self::$_fields)) {
147 self::$_fields = array(
148 'id' => array(
149 'name' => 'id',
150 'type' => CRM_Utils_Type::T_INT,
151 'required' => true,
152 ) ,
153 'entity_table' => array(
154 'name' => 'entity_table',
155 'type' => CRM_Utils_Type::T_STRING,
156 'title' => ts('Entity Table') ,
157 'required' => true,
158 'maxlength' => 64,
159 'size' => CRM_Utils_Type::BIG,
160 ) ,
161 'entity_id' => array(
162 'name' => 'entity_id',
163 'type' => CRM_Utils_Type::T_INT,
164 'required' => true,
165 ) ,
166 'price_set_id' => array(
167 'name' => 'price_set_id',
168 'type' => CRM_Utils_Type::T_INT,
169 'required' => true,
170 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Set',
171 ) ,
172 );
173 }
174 return self::$_fields;
175 }
176 /**
177 * returns the names of this table
178 *
179 * @access public
180 * @static
181 * @return string
182 */
183 static function getTableName()
184 {
185 return self::$_tableName;
186 }
187 /**
188 * returns if this table needs to be logged
189 *
190 * @access public
191 * @return boolean
192 */
193 function getLog()
194 {
195 return self::$_log;
196 }
197 /**
198 * returns the list of fields that can be imported
199 *
200 * @access public
201 * return array
202 * @static
203 */
204 static function &import($prefix = false)
205 {
206 if (!(self::$_import)) {
207 self::$_import = array();
208 $fields = self::fields();
209 foreach($fields as $name => $field) {
a7488080 210 if (!empty($field['import'])) {
6a488035
TO
211 if ($prefix) {
212 self::$_import['price_set_entity'] = & $fields[$name];
213 } else {
214 self::$_import[$name] = & $fields[$name];
215 }
216 }
217 }
218 }
219 return self::$_import;
220 }
221 /**
222 * returns the list of fields that can be exported
223 *
224 * @access public
225 * return array
226 * @static
227 */
228 static function &export($prefix = false)
229 {
230 if (!(self::$_export)) {
231 self::$_export = array();
232 $fields = self::fields();
233 foreach($fields as $name => $field) {
a7488080 234 if (!empty($field['export'])) {
6a488035
TO
235 if ($prefix) {
236 self::$_export['price_set_entity'] = & $fields[$name];
237 } else {
238 self::$_export[$name] = & $fields[$name];
239 }
240 }
241 }
242 }
243 return self::$_export;
244 }
245}