Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/File.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
1713a0ec | 9 | * (GenCodeChecksum:85766eaf78c18044c8e9a6cb485ea117) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the File entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_File extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
fa45b5b9 | 22 | public static $_tableName = 'civicrm_file'; |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
fa45b5b9 | 29 | public static $_log = TRUE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * Unique ID | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value. | |
40 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $file_type_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * mime type of the document | |
47 | * | |
48 | * @var string | |
49 | */ | |
50 | public $mime_type; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * uri of the file on disk | |
54 | * | |
55 | * @var string | |
56 | */ | |
57 | public $uri; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * contents of the document | |
61 | * | |
62 | * @var mediumblob | |
63 | */ | |
64 | public $document; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Additional descriptive text regarding this attachment (optional). | |
68 | * | |
69 | * @var string | |
70 | */ | |
71 | public $description; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Date and time that this attachment was uploaded or written to server. | |
75 | * | |
76 | * @var datetime | |
77 | */ | |
78 | public $upload_date; | |
c3fc2621 | 79 | |
c3438d19 DA |
80 | /** |
81 | * FK to civicrm_contact, who uploaded this file | |
82 | * | |
e6ca0a57 | 83 | * @var int |
c3438d19 DA |
84 | */ |
85 | public $created_id; | |
ae2c7e00 | 86 | |
e501603b | 87 | /** |
f41f0342 | 88 | * Class constructor. |
e501603b | 89 | */ |
c3fc2621 | 90 | public function __construct() { |
e501603b TO |
91 | $this->__table = 'civicrm_file'; |
92 | parent::__construct(); | |
93 | } | |
c3fc2621 | 94 | |
c3438d19 DA |
95 | /** |
96 | * Returns foreign keys and entity references. | |
97 | * | |
98 | * @return array | |
99 | * [CRM_Core_Reference_Interface] | |
100 | */ | |
ae2c7e00 | 101 | public static function getReferenceColumns() { |
c3438d19 | 102 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 103 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
ae2c7e00 | 104 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); |
c3438d19 DA |
105 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
106 | } | |
107 | return Civi::$statics[__CLASS__]['links']; | |
108 | } | |
ae2c7e00 | 109 | |
e501603b TO |
110 | /** |
111 | * Returns all the column names of this table | |
112 | * | |
113 | * @return array | |
114 | */ | |
c3fc2621 | 115 | public static function &fields() { |
346aaaba | 116 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
117 | Civi::$statics[__CLASS__]['fields'] = [ |
118 | 'id' => [ | |
e501603b TO |
119 | 'name' => 'id', |
120 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 121 | 'title' => ts('File ID'), |
215b423e | 122 | 'description' => ts('Unique ID'), |
c3fc2621 | 123 | 'required' => TRUE, |
a36434b9 | 124 | 'where' => 'civicrm_file.id', |
522a26c9 | 125 | 'table_name' => 'civicrm_file', |
126 | 'entity' => 'File', | |
127 | 'bao' => 'CRM_Core_BAO_File', | |
6a7e5e5d | 128 | 'localizable' => 0, |
c3fc2621 CW |
129 | ], |
130 | 'file_type_id' => [ | |
e501603b TO |
131 | 'name' => 'file_type_id', |
132 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 133 | 'title' => ts('File Type'), |
215b423e | 134 | 'description' => ts('Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.'), |
a36434b9 | 135 | 'where' => 'civicrm_file.file_type_id', |
522a26c9 | 136 | 'table_name' => 'civicrm_file', |
137 | 'entity' => 'File', | |
138 | 'bao' => 'CRM_Core_BAO_File', | |
6a7e5e5d | 139 | 'localizable' => 0, |
c3fc2621 CW |
140 | ], |
141 | 'mime_type' => [ | |
e501603b TO |
142 | 'name' => 'mime_type', |
143 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 144 | 'title' => ts('Mime Type'), |
215b423e | 145 | 'description' => ts('mime type of the document'), |
e501603b TO |
146 | 'maxlength' => 255, |
147 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 148 | 'where' => 'civicrm_file.mime_type', |
522a26c9 | 149 | 'table_name' => 'civicrm_file', |
150 | 'entity' => 'File', | |
151 | 'bao' => 'CRM_Core_BAO_File', | |
6a7e5e5d | 152 | 'localizable' => 0, |
c3fc2621 CW |
153 | ], |
154 | 'uri' => [ | |
e501603b TO |
155 | 'name' => 'uri', |
156 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 157 | 'title' => ts('Path'), |
215b423e | 158 | 'description' => ts('uri of the file on disk'), |
e501603b TO |
159 | 'maxlength' => 255, |
160 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 161 | 'where' => 'civicrm_file.uri', |
522a26c9 | 162 | 'table_name' => 'civicrm_file', |
163 | 'entity' => 'File', | |
164 | 'bao' => 'CRM_Core_BAO_File', | |
6a7e5e5d | 165 | 'localizable' => 0, |
c3fc2621 CW |
166 | ], |
167 | 'document' => [ | |
e501603b TO |
168 | 'name' => 'document', |
169 | 'type' => CRM_Utils_Type::T_MEDIUMBLOB, | |
c3fc2621 | 170 | 'title' => ts('File Contents'), |
215b423e | 171 | 'description' => ts('contents of the document'), |
a36434b9 | 172 | 'where' => 'civicrm_file.document', |
522a26c9 | 173 | 'table_name' => 'civicrm_file', |
174 | 'entity' => 'File', | |
175 | 'bao' => 'CRM_Core_BAO_File', | |
6a7e5e5d | 176 | 'localizable' => 0, |
c3fc2621 CW |
177 | ], |
178 | 'description' => [ | |
e501603b TO |
179 | 'name' => 'description', |
180 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 181 | 'title' => ts('File Description'), |
215b423e | 182 | 'description' => ts('Additional descriptive text regarding this attachment (optional).'), |
e501603b TO |
183 | 'maxlength' => 255, |
184 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 185 | 'where' => 'civicrm_file.description', |
522a26c9 | 186 | 'table_name' => 'civicrm_file', |
187 | 'entity' => 'File', | |
188 | 'bao' => 'CRM_Core_BAO_File', | |
6a7e5e5d | 189 | 'localizable' => 0, |
c3fc2621 CW |
190 | ], |
191 | 'upload_date' => [ | |
e501603b TO |
192 | 'name' => 'upload_date', |
193 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 194 | 'title' => ts('File Upload Date'), |
215b423e | 195 | 'description' => ts('Date and time that this attachment was uploaded or written to server.'), |
a36434b9 | 196 | 'where' => 'civicrm_file.upload_date', |
522a26c9 | 197 | 'table_name' => 'civicrm_file', |
198 | 'entity' => 'File', | |
199 | 'bao' => 'CRM_Core_BAO_File', | |
6a7e5e5d | 200 | 'localizable' => 0, |
c3fc2621 | 201 | ], |
c3438d19 DA |
202 | 'created_id' => [ |
203 | 'name' => 'created_id', | |
204 | 'type' => CRM_Utils_Type::T_INT, | |
ae2c7e00 | 205 | 'title' => ts('Created By Contact ID'), |
215b423e | 206 | 'description' => ts('FK to civicrm_contact, who uploaded this file'), |
a36434b9 | 207 | 'where' => 'civicrm_file.created_id', |
c3438d19 DA |
208 | 'table_name' => 'civicrm_file', |
209 | 'entity' => 'File', | |
210 | 'bao' => 'CRM_Core_BAO_File', | |
ae2c7e00 | 211 | 'localizable' => 0, |
c3438d19 DA |
212 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
213 | ], | |
c3fc2621 | 214 | ]; |
346aaaba | 215 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 216 | } |
346aaaba | 217 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 218 | } |
c3fc2621 | 219 | |
e501603b | 220 | /** |
bd8e0b14 | 221 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
222 | * |
223 | * @return array | |
bd8e0b14 | 224 | * Array(string $name => string $uniqueName). |
e501603b | 225 | */ |
c3fc2621 | 226 | public static function &fieldKeys() { |
bd8e0b14 TO |
227 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
228 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 229 | } |
bd8e0b14 | 230 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 231 | } |
c3fc2621 | 232 | |
e501603b TO |
233 | /** |
234 | * Returns the names of this table | |
235 | * | |
236 | * @return string | |
237 | */ | |
c3fc2621 | 238 | public static function getTableName() { |
e501603b TO |
239 | return self::$_tableName; |
240 | } | |
c3fc2621 | 241 | |
e501603b TO |
242 | /** |
243 | * Returns if this table needs to be logged | |
244 | * | |
c3fc2621 | 245 | * @return bool |
e501603b | 246 | */ |
c3fc2621 | 247 | public function getLog() { |
e501603b TO |
248 | return self::$_log; |
249 | } | |
c3fc2621 | 250 | |
e501603b TO |
251 | /** |
252 | * Returns the list of fields that can be imported | |
253 | * | |
254 | * @param bool $prefix | |
255 | * | |
256 | * @return array | |
257 | */ | |
c3fc2621 CW |
258 | public static function &import($prefix = FALSE) { |
259 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'file', $prefix, []); | |
60808919 | 260 | return $r; |
e501603b | 261 | } |
c3fc2621 | 262 | |
e501603b TO |
263 | /** |
264 | * Returns the list of fields that can be exported | |
265 | * | |
266 | * @param bool $prefix | |
267 | * | |
268 | * @return array | |
269 | */ | |
c3fc2621 CW |
270 | public static function &export($prefix = FALSE) { |
271 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'file', $prefix, []); | |
60808919 | 272 | return $r; |
e501603b | 273 | } |
c3fc2621 | 274 | |
e7a6b91a AS |
275 | /** |
276 | * Returns the list of indices | |
c3fc2621 CW |
277 | * |
278 | * @param bool $localize | |
279 | * | |
280 | * @return array | |
e7a6b91a AS |
281 | */ |
282 | public static function indices($localize = TRUE) { | |
c3fc2621 | 283 | $indices = []; |
e7a6b91a AS |
284 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
285 | } | |
c3fc2621 | 286 | |
e501603b | 287 | } |