5 * @copyright CiviCRM LLC (c) 2004-2017
7 * Generated from xml/schema/CRM/Core/File.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:996b2702471b24fb13c740ef104ea1f9)
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.
83 public function __construct() {
84 $this->__table
= 'civicrm_file';
85 parent
::__construct();
89 * Returns all the column names of this table
93 public static function &fields() {
94 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
95 Civi
::$statics[__CLASS__
]['fields'] = [
98 'type' => CRM_Utils_Type
::T_INT
,
99 'title' => ts('File ID'),
100 'description' => 'Unique ID',
102 'table_name' => 'civicrm_file',
104 'bao' => 'CRM_Core_BAO_File',
108 'name' => 'file_type_id',
109 'type' => CRM_Utils_Type
::T_INT
,
110 'title' => ts('File Type'),
111 'description' => 'Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.',
112 'table_name' => 'civicrm_file',
114 'bao' => 'CRM_Core_BAO_File',
118 'name' => 'mime_type',
119 'type' => CRM_Utils_Type
::T_STRING
,
120 'title' => ts('Mime Type'),
121 'description' => 'mime type of the document',
123 'size' => CRM_Utils_Type
::HUGE
,
124 'table_name' => 'civicrm_file',
126 'bao' => 'CRM_Core_BAO_File',
131 'type' => CRM_Utils_Type
::T_STRING
,
132 'title' => ts('Path'),
133 'description' => 'uri of the file on disk',
135 'size' => CRM_Utils_Type
::HUGE
,
136 'table_name' => 'civicrm_file',
138 'bao' => 'CRM_Core_BAO_File',
142 'name' => 'document',
143 'type' => CRM_Utils_Type
::T_MEDIUMBLOB
,
144 'title' => ts('File Contents'),
145 'description' => 'contents of the document',
146 'table_name' => 'civicrm_file',
148 'bao' => 'CRM_Core_BAO_File',
152 'name' => 'description',
153 'type' => CRM_Utils_Type
::T_STRING
,
154 'title' => ts('File Description'),
155 'description' => 'Additional descriptive text regarding this attachment (optional).',
157 'size' => CRM_Utils_Type
::HUGE
,
158 'table_name' => 'civicrm_file',
160 'bao' => 'CRM_Core_BAO_File',
164 'name' => 'upload_date',
165 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
166 'title' => ts('File Upload Date'),
167 'description' => 'Date and time that this attachment was uploaded or written to server.',
168 'table_name' => 'civicrm_file',
170 'bao' => 'CRM_Core_BAO_File',
174 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
176 return Civi
::$statics[__CLASS__
]['fields'];
180 * Return a mapping from field-name to the corresponding key (as used in fields()).
183 * Array(string $name => string $uniqueName).
185 public static function &fieldKeys() {
186 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
187 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
189 return Civi
::$statics[__CLASS__
]['fieldKeys'];
193 * Returns the names of this table
197 public static function getTableName() {
198 return self
::$_tableName;
202 * Returns if this table needs to be logged
206 public function getLog() {
211 * Returns the list of fields that can be imported
213 * @param bool $prefix
217 public static function &import($prefix = FALSE) {
218 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'file', $prefix, []);
223 * Returns the list of fields that can be exported
225 * @param bool $prefix
229 public static function &export($prefix = FALSE) {
230 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'file', $prefix, []);
235 * Returns the list of indices
237 * @param bool $localize
241 public static function indices($localize = TRUE) {
243 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;