In my site, Some media's assets are stored in private folder. I have a custom form where i am using these media assets. When user load the page they are granted the access to use those medias by "private file download access" module. My question is when user submit the form. These media should be also save in public folder. I am doing this by file_get_contents() function (download file from url). See the below code:
I thought I could figure this out, reading the Entity\File.php class governing this entity.
Through a theme, I've uploaded an image in its logo upload form in its settings. I see the file in managed_file with a URI of 'temporary://mylogo.jpg'and a status of 0 which indicates to me that it's in a temporary state that will be destroyed during the next cron run.
$query = db_query("SELECT * FROM `heritage_source_info`WHERE text_id = :textid AND format = :format ORDER BY type ASC", [':textid' => $textid, ':format' => 'text'])->orderBy('FIELD(type,moolam,translation,commentary)');
$available_sources_text = $query->fetchAll();
But it says call to an undefined function orderBy(). Could you help me with the correct syntax?