KnpLabs / Gaufrette

PHP library that provides a filesystem abstraction layer − will be a feast for your files!

Home Page:http://knplabs.github.io/Gaufrette

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Absolute path in AWS adapter

NicolaPez opened this issue · comments

I'm using this code for get the path of an adapter in my project. For the dev enviroment I use an local adapter, and all works fine. In prod enviroment I use an AWS adapter, but don't know how get the absolute path of this. Someone can help me?

...
        $adapter = $filesystemGuafrette->getAdapter();
        $reflection = new \ReflectionClass($adapter);

        if($this->kernel->getEnvironment() == 'dev'){
            $property = 'directory';
        }else{
            //prod enviroment, AWS adapter
            $property = '?';
        }

        $directory = $reflection->getProperty($property);
        $directory->setAccessible(true);
        $prePath = $directory->getValue($adapter);
...

Hello, you can have a look to gaufrette's extras to get the url of your object : https://github.com/Gaufrette/extras