dustin10 / VichUploaderBundle

A simple Symfony bundle to ease file uploads with ORM entities and ODM documents.
MIT License
1.85k stars 519 forks source link

Check metadata type when adding annotation/attribute mapping drivers #1346

Closed andyexeter closed 1 year ago

andyexeter commented 1 year ago

Fixes #1344

The annotation_reader service is not required for attributes to be read, but if the doctrine/annotations package isn't present the service does not exist meaning attribute metadata is not read.

This PR resolves this issue by adding the meta data type config as a parameter and modifying the check for the existence of the service so it short-circuits if the meta data type is attribute.

wimwinterberg commented 1 year ago

When doctrine/annotations is not installed the interface (Doctrine\Common\Annotations\Reader) used by "Metadata/Driver/AttributeReader.php" also does not exists. So code will fail here as well.

I am also looking for a way for it to work without doctrine/annotations

andyexeter commented 1 year ago

@wimwinterberg you are right - I didn't realise doctrine/annotations was still required by a dev dependency so didn't spot that during my testing.

I'm going to close this PR as the approach to solve the issue is incorrect.