Closed YummYume closed 1 year ago
Yes, the feature has been removed and the documentation is outdated (a PR to fix it would be appreciated).
However, array is still supported by the resolveUri
method in Storage classes, so you can still create your twig extension and use arrays instead of objects.
Thanks for the quick answer @garak.
So I did try with resolveUri
, and although this method does accept an array or an object, the getFilename
method only accepts an object... So it ends up throwing an error.
Vich\UploaderBundle\Storage\AbstractStorage::getFilename(): Argument #1 ($obj) must be of type object, array given, called in /app/vendor/vich/uploader-bundle/src/Storage/FileSystemStorage.php on line 60
It seems we're wrong about that since I see that afterwards resolveUri
allows arrays again.
Can you propose a PR to fix it?
At this point, we can restore the possibility in the Twig extension as well
Hi @garak
I am working on it :smile: Can you tell me what tests I should include with this change?
Hi @garak
I am working on it smile Can you tell me what tests I should include with this change?
Having current tests passing could be enough for now. I can add more tests later
Hi @garak
Alright, I made the PR, please tell me if I need to change anything
Support Question
Hello. I am currently running into an issue that could be solved easily by just reading the documentation, but the documentation is outdated.
I want to generate a path (preferably in a twig template) to my image using an array instead of an object. This is because I am using Meilisearch and for performance reasons, I only get results as an array.
In previous versions, it seemed possible to pass in an array and the class name as a third argument, as stated in the doc. However, it was marked as deprecated in earlier versions and later removed. Is there still any support for this? Or do I absolutely need to pass in an entity?