function uc_file_get_by_id in Ubercart 8.4
Same name and namespace in other branches
- 6.2 uc_file/uc_file.module \uc_file_get_by_id()
- 7.3 uc_file/uc_file.module \uc_file_get_by_id()
Retrieves a file by file ID.
Parameters
int $fid: A file ID.
Return value
A uc_file object.
11 calls to uc_file_get_by_id()
- ActionForm::buildForm in uc_file/
src/ Form/ ActionForm.php - Form constructor.
- ActionForm::buildJsFileDisplay in uc_file/
src/ Form/ ActionForm.php - Shows all possible files in selectable list.
- DownloadController::download in uc_file/
src/ Controller/ DownloadController.php - Handles file downloading and error states.
- FileDeleteForm::buildForm in uc_file/
src/ Form/ FileDeleteForm.php - Form constructor.
- FileDeleteForm::buildJsFileDisplay in uc_file/
src/ Form/ FileDeleteForm.php - Shows all possible files in selectable list.
File
- uc_file/
uc_file.module, line 796 - Allows products to be associated with downloadable files.
Code
function &uc_file_get_by_id($fid) {
$cache = _uc_file_get_cache();
$connection = \Drupal::database();
if (!isset($cache[$fid])) {
$cache[$fid] = $connection
->query('SELECT * FROM {uc_files} WHERE fid = :fid', [
':fid' => $fid,
])
->fetchObject();
}
return $cache[$fid];
}