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:99baae76a4c2bf505fa7e0c67706844b)
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',
138 'name' => 'file_type_id',
139 'type' => CRM_Utils_Type
::T_INT
,
140 'title' => ts('File Type'),
141 'description' => ts('Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.'),
142 'where' => 'civicrm_file.file_type_id',
143 'table_name' => 'civicrm_file',
145 'bao' => 'CRM_Core_BAO_File',
149 'name' => 'mime_type',
150 'type' => CRM_Utils_Type
::T_STRING
,
151 'title' => ts('Mime Type'),
152 'description' => ts('mime type of the document'),
154 'size' => CRM_Utils_Type
::HUGE
,
155 'where' => 'civicrm_file.mime_type',
156 'table_name' => 'civicrm_file',
158 'bao' => 'CRM_Core_BAO_File',
163 'type' => CRM_Utils_Type
::T_STRING
,
164 'title' => ts('Path'),
165 'description' => ts('uri of the file on disk'),
167 'size' => CRM_Utils_Type
::HUGE
,
168 'where' => 'civicrm_file.uri',
169 'table_name' => 'civicrm_file',
171 'bao' => 'CRM_Core_BAO_File',
175 'name' => 'document',
176 'type' => CRM_Utils_Type
::T_MEDIUMBLOB
,
177 'title' => ts('File Contents'),
178 'description' => ts('contents of the document'),
179 'where' => 'civicrm_file.document',
180 'table_name' => 'civicrm_file',
182 'bao' => 'CRM_Core_BAO_File',
186 'name' => 'description',
187 'type' => CRM_Utils_Type
::T_STRING
,
188 'title' => ts('File Description'),
189 'description' => ts('Additional descriptive text regarding this attachment (optional).'),
191 'size' => CRM_Utils_Type
::HUGE
,
192 'where' => 'civicrm_file.description',
193 'table_name' => 'civicrm_file',
195 'bao' => 'CRM_Core_BAO_File',
199 'name' => 'upload_date',
200 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
201 'title' => ts('File Upload Date'),
202 'description' => ts('Date and time that this attachment was uploaded or written to server.'),
203 'where' => 'civicrm_file.upload_date',
204 'table_name' => 'civicrm_file',
206 'bao' => 'CRM_Core_BAO_File',
210 'name' => 'created_id',
211 'type' => CRM_Utils_Type
::T_INT
,
212 'title' => ts('Created By Contact ID'),
213 'description' => ts('FK to civicrm_contact, who uploaded this file'),
214 'where' => 'civicrm_file.created_id',
215 'table_name' => 'civicrm_file',
217 'bao' => 'CRM_Core_BAO_File',
219 'FKClassName' => 'CRM_Contact_DAO_Contact',
222 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
224 return Civi
::$statics[__CLASS__
]['fields'];
228 * Return a mapping from field-name to the corresponding key (as used in fields()).
231 * Array(string $name => string $uniqueName).
233 public static function &fieldKeys() {
234 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
235 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
237 return Civi
::$statics[__CLASS__
]['fieldKeys'];
241 * Returns the names of this table
245 public static function getTableName() {
246 return self
::$_tableName;
250 * Returns if this table needs to be logged
254 public function getLog() {
259 * Returns the list of fields that can be imported
261 * @param bool $prefix
265 public static function &import($prefix = FALSE) {
266 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'file', $prefix, []);
271 * Returns the list of fields that can be exported
273 * @param bool $prefix
277 public static function &export($prefix = FALSE) {
278 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'file', $prefix, []);
283 * Returns the list of indices
285 * @param bool $localize
289 public static function indices($localize = TRUE) {
291 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;