Closed klodoma closed 5 years ago
Correct, i have dropped ElFinderPHP in favor to elfinder library itself, and decode function in original repo is protected
I found a workaround, I am currently overriding the loader class. You could replace ->decode with ->getPath(), or better, add a getPath() function
This is what I currently did:
/**
* Class MyElFinderLoader.
*/
class MyElFinderLoader extends ElFinderLoader
{
/**
* Decode path from hash.
*
* @param string $hash
*
* @return string
**/
public function decode($hash)
{
$volume = $this->bridge->getVolume($hash);
/** @var $volume \elFinderVolumeDriver */
return (!empty($volume)) ? $volume->getPath($hash) : false;
}
}
and use this loader in the services.yaml
myElfinderLoader:
class: MappsBundle\Services\MyElFinderLoader
arguments: ["@fm_elfinder.configurator"]
This is how I get the file Path in the backend for a specific hash in Symfony3, (I use version ~6 of this bundle)
"helios-ag/fm-elfinder-bundle": "~6",
where $hash is the hash of the file.
Now, I have upgraded to Symfony 4 and it doesn't work anymore due to a protected method error, which probably is a bug in the library. In Symfony4 I use "helios-ag/fm-elfinder-bundle": "^9.1",
I am not sure if this is the correct way to do it, but is there any other way to get the filePath from a hash?