CRM-14885 - Import DAO's
[civicrm-core.git] / CRM / Core / DAO / File.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/File.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:175852e7e39c740ce903ccc56da20388)
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_File extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_file';
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 * Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.
91 *
92 * @var int unsigned
93 */
94 public $file_type_id;
95 /**
96 * mime type of the document
97 *
98 * @var string
99 */
100 public $mime_type;
101 /**
102 * uri of the file on disk
103 *
104 * @var string
105 */
106 public $uri;
107 /**
108 * contents of the document
109 *
110 * @var mediumblob
111 */
112 public $document;
113 /**
114 * Additional descriptive text regarding this attachment (optional).
115 *
116 * @var string
117 */
118 public $description;
119 /**
120 * Date and time that this attachment was uploaded or written to server.
121 *
122 * @var datetime
123 */
124 public $upload_date;
125 /**
126 * class constructor
127 *
128 * @return civicrm_file
129 */
130 function __construct() {
131 $this->__table = 'civicrm_file';
132 parent::__construct();
133 }
134 /**
135 * Returns all the column names of this table
136 *
137 * @return array
138 */
139 static function &fields() {
140 if (!(self::$_fields)) {
141 self::$_fields = array(
142 'id' => array(
143 'name' => 'id',
144 'type' => CRM_Utils_Type::T_INT,
145 'title' => ts('File ID') ,
146 'description' => 'Unique ID',
147 'required' => true,
148 ) ,
149 'file_type_id' => array(
150 'name' => 'file_type_id',
151 'type' => CRM_Utils_Type::T_INT,
152 'title' => ts('File Type') ,
153 'description' => 'Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.',
154 ) ,
155 'mime_type' => array(
156 'name' => 'mime_type',
157 'type' => CRM_Utils_Type::T_STRING,
158 'title' => ts('Mime Type') ,
159 'description' => 'mime type of the document',
160 'maxlength' => 255,
161 'size' => CRM_Utils_Type::HUGE,
162 ) ,
163 'uri' => array(
164 'name' => 'uri',
165 'type' => CRM_Utils_Type::T_STRING,
166 'title' => ts('Path') ,
167 'description' => 'uri of the file on disk',
168 'maxlength' => 255,
169 'size' => CRM_Utils_Type::HUGE,
170 ) ,
171 'document' => array(
172 'name' => 'document',
173 'type' => CRM_Utils_Type::T_MEDIUMBLOB,
174 'title' => ts('File Contents') ,
175 'description' => 'contents of the document',
176 ) ,
177 'description' => array(
178 'name' => 'description',
179 'type' => CRM_Utils_Type::T_STRING,
180 'title' => ts('File Description') ,
181 'description' => 'Additional descriptive text regarding this attachment (optional).',
182 'maxlength' => 255,
183 'size' => CRM_Utils_Type::HUGE,
184 ) ,
185 'upload_date' => array(
186 'name' => 'upload_date',
187 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
188 'title' => ts('File Upload Date') ,
189 'description' => 'Date and time that this attachment was uploaded or written to server.',
190 ) ,
191 );
192 }
193 return self::$_fields;
194 }
195 /**
196 * Returns an array containing, for each field, the arary key used for that
197 * field in self::$_fields.
198 *
199 * @return array
200 */
201 static function &fieldKeys() {
202 if (!(self::$_fieldKeys)) {
203 self::$_fieldKeys = array(
204 'id' => 'id',
205 'file_type_id' => 'file_type_id',
206 'mime_type' => 'mime_type',
207 'uri' => 'uri',
208 'document' => 'document',
209 'description' => 'description',
210 'upload_date' => 'upload_date',
211 );
212 }
213 return self::$_fieldKeys;
214 }
215 /**
216 * Returns the names of this table
217 *
218 * @return string
219 */
220 static function getTableName() {
221 return self::$_tableName;
222 }
223 /**
224 * Returns if this table needs to be logged
225 *
226 * @return boolean
227 */
228 function getLog() {
229 return self::$_log;
230 }
231 /**
232 * Returns the list of fields that can be imported
233 *
234 * @param bool $prefix
235 *
236 * @return array
237 */
238 static function &import($prefix = false) {
239 if (!(self::$_import)) {
240 self::$_import = array();
241 $fields = self::fields();
242 foreach($fields as $name => $field) {
243 if (CRM_Utils_Array::value('import', $field)) {
244 if ($prefix) {
245 self::$_import['file'] = & $fields[$name];
246 } else {
247 self::$_import[$name] = & $fields[$name];
248 }
249 }
250 }
251 }
252 return self::$_import;
253 }
254 /**
255 * Returns the list of fields that can be exported
256 *
257 * @param bool $prefix
258 *
259 * @return array
260 */
261 static function &export($prefix = false) {
262 if (!(self::$_export)) {
263 self::$_export = array();
264 $fields = self::fields();
265 foreach($fields as $name => $field) {
266 if (CRM_Utils_Array::value('export', $field)) {
267 if ($prefix) {
268 self::$_export['file'] = & $fields[$name];
269 } else {
270 self::$_export[$name] = & $fields[$name];
271 }
272 }
273 }
274 }
275 return self::$_export;
276 }
277}