5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/File.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:5c8f93d416373dd32add73f0bbaa59cc)
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 public static $_tableName = 'civicrm_file';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
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 localized title of this entity.
98 public static function getEntityTitle() {
103 * Returns foreign keys and entity references.
106 * [CRM_Core_Reference_Interface]
108 public static function getReferenceColumns() {
109 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
110 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
111 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
112 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
114 return Civi
::$statics[__CLASS__
]['links'];
118 * Returns all the column names of this table
122 public static function &fields() {
123 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
124 Civi
::$statics[__CLASS__
]['fields'] = [
127 'type' => CRM_Utils_Type
::T_INT
,
128 'title' => ts('File ID'),
129 'description' => ts('Unique ID'),
131 'where' => 'civicrm_file.id',
132 'table_name' => 'civicrm_file',
134 'bao' => 'CRM_Core_BAO_File',
139 'name' => 'file_type_id',
140 'type' => CRM_Utils_Type
::T_INT
,
141 'title' => ts('File Type'),
142 'description' => ts('Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.'),
143 'where' => 'civicrm_file.file_type_id',
144 'table_name' => 'civicrm_file',
146 'bao' => 'CRM_Core_BAO_File',
151 'name' => 'mime_type',
152 'type' => CRM_Utils_Type
::T_STRING
,
153 'title' => ts('Mime Type'),
154 'description' => ts('mime type of the document'),
156 'size' => CRM_Utils_Type
::HUGE
,
157 'where' => 'civicrm_file.mime_type',
158 'table_name' => 'civicrm_file',
160 'bao' => 'CRM_Core_BAO_File',
166 'type' => CRM_Utils_Type
::T_STRING
,
167 'title' => ts('Path'),
168 'description' => ts('uri of the file on disk'),
170 'size' => CRM_Utils_Type
::HUGE
,
171 'where' => 'civicrm_file.uri',
172 'table_name' => 'civicrm_file',
174 'bao' => 'CRM_Core_BAO_File',
179 'name' => 'document',
180 'type' => CRM_Utils_Type
::T_MEDIUMBLOB
,
181 'title' => ts('File Contents'),
182 'description' => ts('contents of the document'),
183 'where' => 'civicrm_file.document',
184 'table_name' => 'civicrm_file',
186 'bao' => 'CRM_Core_BAO_File',
191 'name' => 'description',
192 'type' => CRM_Utils_Type
::T_STRING
,
193 'title' => ts('File Description'),
194 'description' => ts('Additional descriptive text regarding this attachment (optional).'),
196 'size' => CRM_Utils_Type
::HUGE
,
197 'where' => 'civicrm_file.description',
198 'table_name' => 'civicrm_file',
200 'bao' => 'CRM_Core_BAO_File',
205 'name' => 'upload_date',
206 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
207 'title' => ts('File Upload Date'),
208 'description' => ts('Date and time that this attachment was uploaded or written to server.'),
209 'where' => 'civicrm_file.upload_date',
210 'table_name' => 'civicrm_file',
212 'bao' => 'CRM_Core_BAO_File',
217 'name' => 'created_id',
218 'type' => CRM_Utils_Type
::T_INT
,
219 'title' => ts('Created By Contact ID'),
220 'description' => ts('FK to civicrm_contact, who uploaded this file'),
221 'where' => 'civicrm_file.created_id',
222 'table_name' => 'civicrm_file',
224 'bao' => 'CRM_Core_BAO_File',
226 'FKClassName' => 'CRM_Contact_DAO_Contact',
230 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
232 return Civi
::$statics[__CLASS__
]['fields'];
236 * Return a mapping from field-name to the corresponding key (as used in fields()).
239 * Array(string $name => string $uniqueName).
241 public static function &fieldKeys() {
242 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
243 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
245 return Civi
::$statics[__CLASS__
]['fieldKeys'];
249 * Returns the names of this table
253 public static function getTableName() {
254 return self
::$_tableName;
258 * Returns if this table needs to be logged
262 public function getLog() {
267 * Returns the list of fields that can be imported
269 * @param bool $prefix
273 public static function &import($prefix = FALSE) {
274 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'file', $prefix, []);
279 * Returns the list of fields that can be exported
281 * @param bool $prefix
285 public static function &export($prefix = FALSE) {
286 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'file', $prefix, []);
291 * Returns the list of indices
293 * @param bool $localize
297 public static function indices($localize = TRUE) {
299 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;