Regen DAOs with new fieldKeys()
[civicrm-core.git] / CRM / Batch / DAO / Batch.php
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/Batch/Batch.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:81081e8ad03b0097ba7949b4425b1ca8)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_batch';
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 FK relationships
52 *
53 * @var string
54 */
55 static $_links = null;
56 /**
57 * static value to see if we should log any modifications to
58 * this table in the civicrm_log table
59 *
60 * @var boolean
61 */
62 static $_log = false;
63 /**
64 * Unique Address ID
65 *
66 * @var int unsigned
67 */
68 public $id;
69 /**
70 * Variable name/programmatic handle for this batch.
71 *
72 * @var string
73 */
74 public $name;
75 /**
76 * Friendly Name.
77 *
78 * @var string
79 */
80 public $title;
81 /**
82 * Description of this batch set.
83 *
84 * @var text
85 */
86 public $description;
87 /**
88 * FK to Contact ID
89 *
90 * @var int unsigned
91 */
92 public $created_id;
93 /**
94 * When was this item created
95 *
96 * @var datetime
97 */
98 public $created_date;
99 /**
100 * FK to Contact ID
101 *
102 * @var int unsigned
103 */
104 public $modified_id;
105 /**
106 * When was this item created
107 *
108 * @var datetime
109 */
110 public $modified_date;
111 /**
112 * FK to Saved Search ID
113 *
114 * @var int unsigned
115 */
116 public $saved_search_id;
117 /**
118 * fk to Batch Status options in civicrm_option_values
119 *
120 * @var int unsigned
121 */
122 public $status_id;
123 /**
124 * fk to Batch Type options in civicrm_option_values
125 *
126 * @var int unsigned
127 */
128 public $type_id;
129 /**
130 * fk to Batch mode options in civicrm_option_values
131 *
132 * @var int unsigned
133 */
134 public $mode_id;
135 /**
136 * Total amount for this batch.
137 *
138 * @var float
139 */
140 public $total;
141 /**
142 * Number of items in a batch.
143 *
144 * @var int unsigned
145 */
146 public $item_count;
147 /**
148 * fk to Payment Instrument options in civicrm_option_values
149 *
150 * @var int unsigned
151 */
152 public $payment_instrument_id;
153 /**
154 *
155 * @var datetime
156 */
157 public $exported_date;
158 /**
159 * cache entered data
160 *
161 * @var longtext
162 */
163 public $data;
164 /**
165 * class constructor
166 *
167 * @return civicrm_batch
168 */
169 function __construct() {
170 $this->__table = 'civicrm_batch';
171 parent::__construct();
172 }
173 /**
174 * Returns foreign keys and entity references
175 *
176 * @return array
177 * [CRM_Core_Reference_Interface]
178 */
179 static function getReferenceColumns() {
180 if (!self::$_links) {
181 self::$_links = static ::createReferenceColumns(__CLASS__);
182 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
183 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'modified_id', 'civicrm_contact', 'id');
184 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'saved_search_id', 'civicrm_saved_search', 'id');
185 }
186 return self::$_links;
187 }
188 /**
189 * Returns all the column names of this table
190 *
191 * @return array
192 */
193 static function &fields() {
194 if (!(self::$_fields)) {
195 self::$_fields = array(
196 'id' => array(
197 'name' => 'id',
198 'type' => CRM_Utils_Type::T_INT,
199 'title' => ts('Batch ID') ,
200 'description' => 'Unique Address ID',
201 'required' => true,
202 ) ,
203 'name' => array(
204 'name' => 'name',
205 'type' => CRM_Utils_Type::T_STRING,
206 'title' => ts('Batch Name') ,
207 'description' => 'Variable name/programmatic handle for this batch.',
208 'maxlength' => 64,
209 'size' => CRM_Utils_Type::BIG,
210 'html' => array(
211 'type' => 'Text',
212 ) ,
213 ) ,
214 'title' => array(
215 'name' => 'title',
216 'type' => CRM_Utils_Type::T_STRING,
217 'title' => ts('Batch Title') ,
218 'description' => 'Friendly Name.',
219 'maxlength' => 64,
220 'size' => CRM_Utils_Type::BIG,
221 'html' => array(
222 'type' => 'Text',
223 ) ,
224 ) ,
225 'description' => array(
226 'name' => 'description',
227 'type' => CRM_Utils_Type::T_TEXT,
228 'title' => ts('Batch Description') ,
229 'description' => 'Description of this batch set.',
230 'rows' => 4,
231 'cols' => 80,
232 'html' => array(
233 'type' => 'TextArea',
234 ) ,
235 ) ,
236 'created_id' => array(
237 'name' => 'created_id',
238 'type' => CRM_Utils_Type::T_INT,
239 'title' => ts('Batch Created By') ,
240 'description' => 'FK to Contact ID',
241 'FKClassName' => 'CRM_Contact_DAO_Contact',
242 ) ,
243 'created_date' => array(
244 'name' => 'created_date',
245 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
246 'title' => ts('Batch Created Date') ,
247 'description' => 'When was this item created',
248 'html' => array(
249 'type' => 'Select Date',
250 ) ,
251 ) ,
252 'modified_id' => array(
253 'name' => 'modified_id',
254 'type' => CRM_Utils_Type::T_INT,
255 'title' => ts('Batch Modified By') ,
256 'description' => 'FK to Contact ID',
257 'FKClassName' => 'CRM_Contact_DAO_Contact',
258 ) ,
259 'modified_date' => array(
260 'name' => 'modified_date',
261 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
262 'title' => ts('Batch Modified Date') ,
263 'description' => 'When was this item created',
264 ) ,
265 'saved_search_id' => array(
266 'name' => 'saved_search_id',
267 'type' => CRM_Utils_Type::T_INT,
268 'title' => ts('Batch Smart Group') ,
269 'description' => 'FK to Saved Search ID',
270 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
271 'html' => array(
272 'type' => 'EntityRef',
273 ) ,
274 ) ,
275 'status_id' => array(
276 'name' => 'status_id',
277 'type' => CRM_Utils_Type::T_INT,
278 'title' => ts('Batch Status') ,
279 'description' => 'fk to Batch Status options in civicrm_option_values',
280 'required' => true,
281 'html' => array(
282 'type' => 'Select',
283 ) ,
284 'pseudoconstant' => array(
285 'optionGroupName' => 'batch_status',
286 'optionEditPath' => 'civicrm/admin/options/batch_status',
287 )
288 ) ,
289 'type_id' => array(
290 'name' => 'type_id',
291 'type' => CRM_Utils_Type::T_INT,
292 'title' => ts('Batch Type') ,
293 'description' => 'fk to Batch Type options in civicrm_option_values',
294 'html' => array(
295 'type' => 'Select',
296 ) ,
297 'pseudoconstant' => array(
298 'optionGroupName' => 'batch_type',
299 'optionEditPath' => 'civicrm/admin/options/batch_type',
300 )
301 ) ,
302 'mode_id' => array(
303 'name' => 'mode_id',
304 'type' => CRM_Utils_Type::T_INT,
305 'title' => ts('Batch Mode') ,
306 'description' => 'fk to Batch mode options in civicrm_option_values',
307 'html' => array(
308 'type' => 'Select',
309 ) ,
310 'pseudoconstant' => array(
311 'optionGroupName' => 'batch_mode',
312 'optionEditPath' => 'civicrm/admin/options/batch_mode',
313 )
314 ) ,
315 'total' => array(
316 'name' => 'total',
317 'type' => CRM_Utils_Type::T_MONEY,
318 'title' => ts('Batch Total') ,
319 'description' => 'Total amount for this batch.',
320 'precision' => array(
321 20,
322 2
323 ) ,
324 'html' => array(
325 'type' => 'Text',
326 ) ,
327 ) ,
328 'item_count' => array(
329 'name' => 'item_count',
330 'type' => CRM_Utils_Type::T_INT,
331 'title' => ts('Batch Number of Items') ,
332 'description' => 'Number of items in a batch.',
333 'html' => array(
334 'type' => 'Text',
335 ) ,
336 ) ,
337 'payment_instrument_id' => array(
338 'name' => 'payment_instrument_id',
339 'type' => CRM_Utils_Type::T_INT,
340 'title' => ts('Batch Payment Method') ,
341 'description' => 'fk to Payment Instrument options in civicrm_option_values',
342 'html' => array(
343 'type' => 'Select',
344 ) ,
345 'pseudoconstant' => array(
346 'optionGroupName' => 'payment_instrument',
347 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
348 )
349 ) ,
350 'exported_date' => array(
351 'name' => 'exported_date',
352 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
353 'title' => ts('Batch Exported Date') ,
354 ) ,
355 'data' => array(
356 'name' => 'data',
357 'type' => CRM_Utils_Type::T_LONGTEXT,
358 'title' => ts('Batch Data') ,
359 'description' => 'cache entered data',
360 ) ,
361 );
362 }
363 return self::$_fields;
364 }
365 /**
366 * Return a mapping from field-name to the corresponding key (as used in fields()).
367 *
368 * @return array
369 * Array(string $name => string $uniqueName).
370 */
371 static function &fieldKeys() {
372 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
373 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
374 }
375 return Civi::$statics[__CLASS__]['fieldKeys'];
376 }
377 /**
378 * Returns the names of this table
379 *
380 * @return string
381 */
382 static function getTableName() {
383 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
384 }
385 /**
386 * Returns if this table needs to be logged
387 *
388 * @return boolean
389 */
390 function getLog() {
391 return self::$_log;
392 }
393 /**
394 * Returns the list of fields that can be imported
395 *
396 * @param bool $prefix
397 *
398 * @return array
399 */
400 static function &import($prefix = false) {
401 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'batch', $prefix, array());
402 return $r;
403 }
404 /**
405 * Returns the list of fields that can be exported
406 *
407 * @param bool $prefix
408 *
409 * @return array
410 */
411 static function &export($prefix = false) {
412 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'batch', $prefix, array());
413 return $r;
414 }
415 }