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:1e39b61dad16348293a20264602193ad)
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 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' => ts('Unique ID'),
124 'where' => 'civicrm_file.id',
125 'table_name' => 'civicrm_file',
127 'bao' => 'CRM_Core_BAO_File',
131 'name' => 'file_type_id',
132 'type' => CRM_Utils_Type
::T_INT
,
133 'title' => ts('File Type'),
134 'description' => ts('Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.'),
135 'where' => 'civicrm_file.file_type_id',
136 'table_name' => 'civicrm_file',
138 'bao' => 'CRM_Core_BAO_File',
142 'name' => 'mime_type',
143 'type' => CRM_Utils_Type
::T_STRING
,
144 'title' => ts('Mime Type'),
145 'description' => ts('mime type of the document'),
147 'size' => CRM_Utils_Type
::HUGE
,
148 'where' => 'civicrm_file.mime_type',
149 'table_name' => 'civicrm_file',
151 'bao' => 'CRM_Core_BAO_File',
156 'type' => CRM_Utils_Type
::T_STRING
,
157 'title' => ts('Path'),
158 'description' => ts('uri of the file on disk'),
160 'size' => CRM_Utils_Type
::HUGE
,
161 'where' => 'civicrm_file.uri',
162 'table_name' => 'civicrm_file',
164 'bao' => 'CRM_Core_BAO_File',
168 'name' => 'document',
169 'type' => CRM_Utils_Type
::T_MEDIUMBLOB
,
170 'title' => ts('File Contents'),
171 'description' => ts('contents of the document'),
172 'where' => 'civicrm_file.document',
173 'table_name' => 'civicrm_file',
175 'bao' => 'CRM_Core_BAO_File',
179 'name' => 'description',
180 'type' => CRM_Utils_Type
::T_STRING
,
181 'title' => ts('File Description'),
182 'description' => ts('Additional descriptive text regarding this attachment (optional).'),
184 'size' => CRM_Utils_Type
::HUGE
,
185 'where' => 'civicrm_file.description',
186 'table_name' => 'civicrm_file',
188 'bao' => 'CRM_Core_BAO_File',
192 'name' => 'upload_date',
193 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
194 'title' => ts('File Upload Date'),
195 'description' => ts('Date and time that this attachment was uploaded or written to server.'),
196 'where' => 'civicrm_file.upload_date',
197 'table_name' => 'civicrm_file',
199 'bao' => 'CRM_Core_BAO_File',
203 'name' => 'created_id',
204 'type' => CRM_Utils_Type
::T_INT
,
205 'title' => ts('Created By Contact ID'),
206 'description' => ts('FK to civicrm_contact, who uploaded this file'),
207 'where' => 'civicrm_file.created_id',
208 'table_name' => 'civicrm_file',
210 'bao' => 'CRM_Core_BAO_File',
212 'FKClassName' => 'CRM_Contact_DAO_Contact',
215 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
217 return Civi
::$statics[__CLASS__
]['fields'];
221 * Return a mapping from field-name to the corresponding key (as used in fields()).
224 * Array(string $name => string $uniqueName).
226 public static function &fieldKeys() {
227 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
228 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
230 return Civi
::$statics[__CLASS__
]['fieldKeys'];
234 * Returns the names of this table
238 public static function getTableName() {
239 return self
::$_tableName;
243 * Returns if this table needs to be logged
247 public function getLog() {
252 * Returns the list of fields that can be imported
254 * @param bool $prefix
258 public static function &import($prefix = FALSE) {
259 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'file', $prefix, []);
264 * Returns the list of fields that can be exported
266 * @param bool $prefix
270 public static function &export($prefix = FALSE) {
271 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'file', $prefix, []);
276 * Returns the list of indices
278 * @param bool $localize
282 public static function indices($localize = TRUE) {
284 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;