KnpGaufretteBundle
KnpGaufretteBundle copied to clipboard
Unable to find the wrapper "gaufrette"
Hello.
I have a problem. I get the following error when I want edit my email with FOSUSerBundle.
Warning: is_file(): Unable to find the wrapper "gaufrette" - did you forget to enable it when you configured PHP? in /var/www/workspace/chateagratis/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/FileValidator.php line 85
My config.yml is:
knp_gaufrette:
adapters:
product_adapter:
local:
directory: %kernel.root_dir%/../web/uploads/fotos
perfil_adapter:
local:
directory: %kernel.root_dir%/../web/uploads/perfil
filesystems:
product_image_fs:
adapter: product_adapter
imagen_perfil_fs:
adapter: perfil_adapter
vich_uploader:
db_driver: orm
gaufrette: true
storage: vich_uploader.storage.gaufrette
mappings:
product_image:
uri_prefix: /workspace/myproject/web/uploads/perfil
upload_destination: product_image_fs
imagen_perfil:
uri_prefix: /workspace/myproject/web/uploads/perfil
upload_destination: imagen_perfil_fs
Any idea? Thanks!!
Hello @Chrysweel , in old versions you have to register stream manually in bundle boot method or if you use version from master you can do it in such way: https://github.com/KnpLabs/KnpGaufretteBundle#stream-wrapper
Old version code example:
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Gaufrette\StreamWrapper;
class MyBundle extends Bundle
{
public function boot()
{
$filesystemMap = $this->container->get('knp_gaufrette.filesystem_map');
$streamMap = StreamWrapper::getFilesystemMap();
$streamMap->set(
'product_image_fs',
$filesystemMap->get('product_image_fs')
);
$streamMap->set(
'imagen_perfil_fs',
$filesystemMap->get('imagen_perfil_fs')
);
StreamWrapper::register();
}
}
I'm not sure if it's related or not but I had once a problem if the root folder of the stream is a symlink then is_dir or is_file are not working as expected.
ie. /var/www/app/web/upload -> /data/files and the stream is pointing to /var/www/app/web/upload, this was not working for me (I think it's a PHP issue).
On the other hand if the stream was pointing to a subfolder, then it was working, ie. /var/www/app/web/upload/files
I have the same issue and i use the vich_uploader too.
The Version of Gaufrette is: "knplabs/knp-gaufrette-bundle": "0.2.@dev", "knplabs/gaufrette": "0.2.@dev",
As i added in my config.yml: stream_wrapper: ~
The Error was away. But i became other error:
The mime type of the file is invalid ("application/ogg"). Allowed mime types are "video/mpeg", "video/mp4", "video/ogg", "video/quicktime", "video/webm", "video/x-matroska", "video/x-ms-wmv", "video/x-flv".
This mime typ is declared on vich_uploader bundle. The fileattribute was not used on edit mode. But i can not unterstand why check filetype on edit mode?