5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Core/File.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:7fd8d2643aa05e33a38983f719c09111)
13 * Database access object for the File entity.
15 class CRM_Core_DAO_File
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 static $_tableName = 'civicrm_file';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
39 * Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.
46 * mime type of the document
53 * uri of the file on disk
60 * contents of the document
67 * Additional descriptive text regarding this attachment (optional).
74 * Date and time that this attachment was uploaded or written to server.
81 * FK to civicrm_contact, who uploaded this file
90 public function __construct() {
91 $this->__table
= 'civicrm_file';
92 parent
::__construct();
96 * Returns foreign keys and entity references.
99 * [CRM_Core_Reference_Interface]
101 public static function getReferenceColumns() {
102 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
103 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
104 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
105 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
107 return Civi
::$statics[__CLASS__
]['links'];
111 * Returns all the column names of this table
115 public static function &fields() {
116 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
117 Civi
::$statics[__CLASS__
]['fields'] = [
120 'type' => CRM_Utils_Type
::T_INT
,
121 'title' => ts('File ID'),
122 'description' => 'Unique ID',
124 'table_name' => 'civicrm_file',
126 'bao' => 'CRM_Core_BAO_File',
130 'name' => 'file_type_id',
131 'type' => CRM_Utils_Type
::T_INT
,
132 'title' => ts('File Type'),
133 'description' => 'Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.',
134 'table_name' => 'civicrm_file',
136 'bao' => 'CRM_Core_BAO_File',
140 'name' => 'mime_type',
141 'type' => CRM_Utils_Type
::T_STRING
,
142 'title' => ts('Mime Type'),
143 'description' => 'mime type of the document',
145 'size' => CRM_Utils_Type
::HUGE
,
146 'table_name' => 'civicrm_file',
148 'bao' => 'CRM_Core_BAO_File',
153 'type' => CRM_Utils_Type
::T_STRING
,
154 'title' => ts('Path'),
155 'description' => 'uri of the file on disk',
157 'size' => CRM_Utils_Type
::HUGE
,
158 'table_name' => 'civicrm_file',
160 'bao' => 'CRM_Core_BAO_File',
164 'name' => 'document',
165 'type' => CRM_Utils_Type
::T_MEDIUMBLOB
,
166 'title' => ts('File Contents'),
167 'description' => 'contents of the document',
168 'table_name' => 'civicrm_file',
170 'bao' => 'CRM_Core_BAO_File',
174 'name' => 'description',
175 'type' => CRM_Utils_Type
::T_STRING
,
176 'title' => ts('File Description'),
177 'description' => 'Additional descriptive text regarding this attachment (optional).',
179 'size' => CRM_Utils_Type
::HUGE
,
180 'table_name' => 'civicrm_file',
182 'bao' => 'CRM_Core_BAO_File',
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 'table_name' => 'civicrm_file',
192 'bao' => 'CRM_Core_BAO_File',
196 'name' => 'created_id',
197 'type' => CRM_Utils_Type
::T_INT
,
198 'title' => ts('Created By Contact ID'),
199 'description' => 'FK to civicrm_contact, who uploaded this file',
200 'table_name' => 'civicrm_file',
202 'bao' => 'CRM_Core_BAO_File',
204 'FKClassName' => 'CRM_Contact_DAO_Contact',
207 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
209 return Civi
::$statics[__CLASS__
]['fields'];
213 * Return a mapping from field-name to the corresponding key (as used in fields()).
216 * Array(string $name => string $uniqueName).
218 public static function &fieldKeys() {
219 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
220 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
222 return Civi
::$statics[__CLASS__
]['fieldKeys'];
226 * Returns the names of this table
230 public static function getTableName() {
231 return self
::$_tableName;
235 * Returns if this table needs to be logged
239 public function getLog() {
244 * Returns the list of fields that can be imported
246 * @param bool $prefix
250 public static function &import($prefix = FALSE) {
251 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'file', $prefix, []);
256 * Returns the list of fields that can be exported
258 * @param bool $prefix
262 public static function &export($prefix = FALSE) {
263 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'file', $prefix, []);
268 * Returns the list of indices
270 * @param bool $localize
274 public static function indices($localize = TRUE) {
276 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;