xml/templates/dao.tpl - Centralize export() / import() logic
[civicrm-core.git] / CRM / Core / DAO / LocBlock.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
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 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Core/LocBlock.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:3b7c983be2e2ecc28d15c6ae02681985)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_LocBlock extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_loc_block';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = true;
83 /**
84 * Unique ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 *
91 * @var int unsigned
92 */
93 public $address_id;
94 /**
95 *
96 * @var int unsigned
97 */
98 public $email_id;
99 /**
100 *
101 * @var int unsigned
102 */
103 public $phone_id;
104 /**
105 *
106 * @var int unsigned
107 */
108 public $im_id;
109 /**
110 *
111 * @var int unsigned
112 */
113 public $address_2_id;
114 /**
115 *
116 * @var int unsigned
117 */
118 public $email_2_id;
119 /**
120 *
121 * @var int unsigned
122 */
123 public $phone_2_id;
124 /**
125 *
126 * @var int unsigned
127 */
128 public $im_2_id;
129 /**
130 * class constructor
131 *
132 * @return civicrm_loc_block
133 */
134 function __construct() {
135 $this->__table = 'civicrm_loc_block';
136 parent::__construct();
137 }
138 /**
139 * Returns foreign keys and entity references
140 *
141 * @return array
142 * [CRM_Core_Reference_Interface]
143 */
144 static function getReferenceColumns() {
145 if (!self::$_links) {
146 self::$_links = static ::createReferenceColumns(__CLASS__);
147 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_id', 'civicrm_address', 'id');
148 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id');
149 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_id', 'civicrm_phone', 'id');
150 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'im_id', 'civicrm_im', 'id');
151 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_2_id', 'civicrm_address', 'id');
152 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_2_id', 'civicrm_email', 'id');
153 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_2_id', 'civicrm_phone', 'id');
154 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'im_2_id', 'civicrm_im', 'id');
155 }
156 return self::$_links;
157 }
158 /**
159 * Returns all the column names of this table
160 *
161 * @return array
162 */
163 static function &fields() {
164 if (!(self::$_fields)) {
165 self::$_fields = array(
166 'id' => array(
167 'name' => 'id',
168 'type' => CRM_Utils_Type::T_INT,
169 'title' => ts('Location Block ID') ,
170 'description' => 'Unique ID',
171 'required' => true,
172 ) ,
173 'address_id' => array(
174 'name' => 'address_id',
175 'type' => CRM_Utils_Type::T_INT,
176 'title' => ts('Location Block Address') ,
177 'FKClassName' => 'CRM_Core_DAO_Address',
178 ) ,
179 'email_id' => array(
180 'name' => 'email_id',
181 'type' => CRM_Utils_Type::T_INT,
182 'title' => ts('Location Block Email') ,
183 'FKClassName' => 'CRM_Core_DAO_Email',
184 ) ,
185 'phone_id' => array(
186 'name' => 'phone_id',
187 'type' => CRM_Utils_Type::T_INT,
188 'title' => ts('Location Block Phone') ,
189 'FKClassName' => 'CRM_Core_DAO_Phone',
190 ) ,
191 'im_id' => array(
192 'name' => 'im_id',
193 'type' => CRM_Utils_Type::T_INT,
194 'title' => ts('Location Block IM') ,
195 'FKClassName' => 'CRM_Core_DAO_IM',
196 ) ,
197 'address_2_id' => array(
198 'name' => 'address_2_id',
199 'type' => CRM_Utils_Type::T_INT,
200 'title' => ts('Location Block IM 2') ,
201 'FKClassName' => 'CRM_Core_DAO_Address',
202 ) ,
203 'email_2_id' => array(
204 'name' => 'email_2_id',
205 'type' => CRM_Utils_Type::T_INT,
206 'title' => ts('Email 2') ,
207 'FKClassName' => 'CRM_Core_DAO_Email',
208 ) ,
209 'phone_2_id' => array(
210 'name' => 'phone_2_id',
211 'type' => CRM_Utils_Type::T_INT,
212 'title' => ts('Phone 2') ,
213 'FKClassName' => 'CRM_Core_DAO_Phone',
214 ) ,
215 'im_2_id' => array(
216 'name' => 'im_2_id',
217 'type' => CRM_Utils_Type::T_INT,
218 'title' => ts('Instant Messenger 2') ,
219 'FKClassName' => 'CRM_Core_DAO_IM',
220 ) ,
221 );
222 }
223 return self::$_fields;
224 }
225 /**
226 * Returns an array containing, for each field, the arary key used for that
227 * field in self::$_fields.
228 *
229 * @return array
230 */
231 static function &fieldKeys() {
232 if (!(self::$_fieldKeys)) {
233 self::$_fieldKeys = array(
234 'id' => 'id',
235 'address_id' => 'address_id',
236 'email_id' => 'email_id',
237 'phone_id' => 'phone_id',
238 'im_id' => 'im_id',
239 'address_2_id' => 'address_2_id',
240 'email_2_id' => 'email_2_id',
241 'phone_2_id' => 'phone_2_id',
242 'im_2_id' => 'im_2_id',
243 );
244 }
245 return self::$_fieldKeys;
246 }
247 /**
248 * Returns the names of this table
249 *
250 * @return string
251 */
252 static function getTableName() {
253 return self::$_tableName;
254 }
255 /**
256 * Returns if this table needs to be logged
257 *
258 * @return boolean
259 */
260 function getLog() {
261 return self::$_log;
262 }
263 /**
264 * Returns the list of fields that can be imported
265 *
266 * @param bool $prefix
267 *
268 * @return array
269 */
270 static function &import($prefix = false) {
271 if (!(self::$_import)) {
272 self::$_import = array();
273 $fields = self::fields();
274 foreach($fields as $name => $field) {
275 if (CRM_Utils_Array::value('import', $field)) {
276 if ($prefix) {
277 self::$_import['loc_block'] = & $fields[$name];
278 } else {
279 self::$_import[$name] = & $fields[$name];
280 }
281 }
282 }
283 }
284 return self::$_import;
285 }
286 /**
287 * Returns the list of fields that can be exported
288 *
289 * @param bool $prefix
290 *
291 * @return array
292 */
293 static function &export($prefix = false) {
294 if (!(self::$_export)) {
295 self::$_export = array();
296 $fields = self::fields();
297 foreach($fields as $name => $field) {
298 if (CRM_Utils_Array::value('export', $field)) {
299 if ($prefix) {
300 self::$_export['loc_block'] = & $fields[$name];
301 } else {
302 self::$_export[$name] = & $fields[$name];
303 }
304 }
305 }
306 }
307 return self::$_export;
308 }
309}