Merge pull request #22631 from braders/calculateBaseScheduleDate-docblock
[civicrm-core.git] / CRM / Core / DAO / File.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/File.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:432bca89c164c512fa77945f8958e60d)
10 */
11
12 /**
13 * Database access object for the File entity.
14 */
15 class CRM_Core_DAO_File extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.5';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_file';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = TRUE;
32
33 /**
34 * Unique ID
35 *
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
39 */
40 public $id;
41
42 /**
43 * Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.
44 *
45 * @var int|string|null
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
48 */
49 public $file_type_id;
50
51 /**
52 * mime type of the document
53 *
54 * @var string|null
55 * (SQL type: varchar(255))
56 * Note that values will be retrieved from the database as a string.
57 */
58 public $mime_type;
59
60 /**
61 * uri of the file on disk
62 *
63 * @var string|null
64 * (SQL type: varchar(255))
65 * Note that values will be retrieved from the database as a string.
66 */
67 public $uri;
68
69 /**
70 * contents of the document
71 *
72 * @var string|null
73 * (SQL type: mediumblob)
74 * Note that values will be retrieved from the database as a string.
75 */
76 public $document;
77
78 /**
79 * Additional descriptive text regarding this attachment (optional).
80 *
81 * @var string|null
82 * (SQL type: varchar(255))
83 * Note that values will be retrieved from the database as a string.
84 */
85 public $description;
86
87 /**
88 * Date and time that this attachment was uploaded or written to server.
89 *
90 * @var string|null
91 * (SQL type: datetime)
92 * Note that values will be retrieved from the database as a string.
93 */
94 public $upload_date;
95
96 /**
97 * FK to civicrm_contact, who uploaded this file
98 *
99 * @var int|string|null
100 * (SQL type: int unsigned)
101 * Note that values will be retrieved from the database as a string.
102 */
103 public $created_id;
104
105 /**
106 * Class constructor.
107 */
108 public function __construct() {
109 $this->__table = 'civicrm_file';
110 parent::__construct();
111 }
112
113 /**
114 * Returns localized title of this entity.
115 *
116 * @param bool $plural
117 * Whether to return the plural version of the title.
118 */
119 public static function getEntityTitle($plural = FALSE) {
120 return $plural ? ts('Files') : ts('File');
121 }
122
123 /**
124 * Returns foreign keys and entity references.
125 *
126 * @return array
127 * [CRM_Core_Reference_Interface]
128 */
129 public static function getReferenceColumns() {
130 if (!isset(Civi::$statics[__CLASS__]['links'])) {
131 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
132 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
133 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
134 }
135 return Civi::$statics[__CLASS__]['links'];
136 }
137
138 /**
139 * Returns all the column names of this table
140 *
141 * @return array
142 */
143 public static function &fields() {
144 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
145 Civi::$statics[__CLASS__]['fields'] = [
146 'id' => [
147 'name' => 'id',
148 'type' => CRM_Utils_Type::T_INT,
149 'title' => ts('File ID'),
150 'description' => ts('Unique ID'),
151 'required' => TRUE,
152 'where' => 'civicrm_file.id',
153 'table_name' => 'civicrm_file',
154 'entity' => 'File',
155 'bao' => 'CRM_Core_BAO_File',
156 'localizable' => 0,
157 'html' => [
158 'type' => 'Number',
159 ],
160 'readonly' => TRUE,
161 'add' => '1.5',
162 ],
163 'file_type_id' => [
164 'name' => 'file_type_id',
165 'type' => CRM_Utils_Type::T_INT,
166 'title' => ts('File Type'),
167 'description' => ts('Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.'),
168 'where' => 'civicrm_file.file_type_id',
169 'table_name' => 'civicrm_file',
170 'entity' => 'File',
171 'bao' => 'CRM_Core_BAO_File',
172 'localizable' => 0,
173 'add' => '1.5',
174 ],
175 'mime_type' => [
176 'name' => 'mime_type',
177 'type' => CRM_Utils_Type::T_STRING,
178 'title' => ts('Mime Type'),
179 'description' => ts('mime type of the document'),
180 'maxlength' => 255,
181 'size' => CRM_Utils_Type::HUGE,
182 'where' => 'civicrm_file.mime_type',
183 'table_name' => 'civicrm_file',
184 'entity' => 'File',
185 'bao' => 'CRM_Core_BAO_File',
186 'localizable' => 0,
187 'add' => '1.5',
188 ],
189 'uri' => [
190 'name' => 'uri',
191 'type' => CRM_Utils_Type::T_STRING,
192 'title' => ts('Path'),
193 'description' => ts('uri of the file on disk'),
194 'maxlength' => 255,
195 'size' => CRM_Utils_Type::HUGE,
196 'where' => 'civicrm_file.uri',
197 'table_name' => 'civicrm_file',
198 'entity' => 'File',
199 'bao' => 'CRM_Core_BAO_File',
200 'localizable' => 0,
201 'add' => '1.5',
202 ],
203 'document' => [
204 'name' => 'document',
205 'type' => CRM_Utils_Type::T_MEDIUMBLOB,
206 'title' => ts('File Contents'),
207 'description' => ts('contents of the document'),
208 'where' => 'civicrm_file.document',
209 'table_name' => 'civicrm_file',
210 'entity' => 'File',
211 'bao' => 'CRM_Core_BAO_File',
212 'localizable' => 0,
213 'add' => '1.5',
214 ],
215 'description' => [
216 'name' => 'description',
217 'type' => CRM_Utils_Type::T_STRING,
218 'title' => ts('File Description'),
219 'description' => ts('Additional descriptive text regarding this attachment (optional).'),
220 'maxlength' => 255,
221 'size' => CRM_Utils_Type::HUGE,
222 'where' => 'civicrm_file.description',
223 'table_name' => 'civicrm_file',
224 'entity' => 'File',
225 'bao' => 'CRM_Core_BAO_File',
226 'localizable' => 0,
227 'add' => '1.5',
228 ],
229 'upload_date' => [
230 'name' => 'upload_date',
231 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
232 'title' => ts('File Upload Date'),
233 'description' => ts('Date and time that this attachment was uploaded or written to server.'),
234 'where' => 'civicrm_file.upload_date',
235 'table_name' => 'civicrm_file',
236 'entity' => 'File',
237 'bao' => 'CRM_Core_BAO_File',
238 'localizable' => 0,
239 'add' => '1.5',
240 ],
241 'created_id' => [
242 'name' => 'created_id',
243 'type' => CRM_Utils_Type::T_INT,
244 'title' => ts('Created By Contact ID'),
245 'description' => ts('FK to civicrm_contact, who uploaded this file'),
246 'where' => 'civicrm_file.created_id',
247 'table_name' => 'civicrm_file',
248 'entity' => 'File',
249 'bao' => 'CRM_Core_BAO_File',
250 'localizable' => 0,
251 'FKClassName' => 'CRM_Contact_DAO_Contact',
252 'html' => [
253 'label' => ts("Created By"),
254 ],
255 'add' => '5.3',
256 ],
257 ];
258 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
259 }
260 return Civi::$statics[__CLASS__]['fields'];
261 }
262
263 /**
264 * Return a mapping from field-name to the corresponding key (as used in fields()).
265 *
266 * @return array
267 * Array(string $name => string $uniqueName).
268 */
269 public static function &fieldKeys() {
270 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
271 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
272 }
273 return Civi::$statics[__CLASS__]['fieldKeys'];
274 }
275
276 /**
277 * Returns the names of this table
278 *
279 * @return string
280 */
281 public static function getTableName() {
282 return self::$_tableName;
283 }
284
285 /**
286 * Returns if this table needs to be logged
287 *
288 * @return bool
289 */
290 public function getLog() {
291 return self::$_log;
292 }
293
294 /**
295 * Returns the list of fields that can be imported
296 *
297 * @param bool $prefix
298 *
299 * @return array
300 */
301 public static function &import($prefix = FALSE) {
302 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'file', $prefix, []);
303 return $r;
304 }
305
306 /**
307 * Returns the list of fields that can be exported
308 *
309 * @param bool $prefix
310 *
311 * @return array
312 */
313 public static function &export($prefix = FALSE) {
314 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'file', $prefix, []);
315 return $r;
316 }
317
318 /**
319 * Returns the list of indices
320 *
321 * @param bool $localize
322 *
323 * @return array
324 */
325 public static function indices($localize = TRUE) {
326 $indices = [];
327 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
328 }
329
330 }