VichUploaderBundle: Broken metadata when updated Doctrine to 2.8.0

Bug Report

Q A
BC Break no
Bundle version 2.0.1
Symfony version 6.2.2
PHP version 8.2.0

Summary

Vich\UploaderBundle\Exception\NotUploadableException on all entities after update Doctrine to 2.8.0

Current behavior

All the uploadable entities are broken with Vich\UploaderBundle\Exception\NotUploadableException

doctrine/doctrine-bundle doesn’t require doctrine/annotations anymore which breaks metadata reader, to fix it I’ve added doctrine/annotations:1.14.1 to dependencies list, but it seems not to be a correct solution. It’d be nice if we can drop requirement of deprecated library.

How to reproduce

composer require doctrine/doctrine-bundle:2.8.0 and refer to any uploadable field of any uploadable entity.

Expected behavior

uploadable entities works.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 30 (11 by maintainers)

Most upvoted comments

Any release soon ?

I hope for the next weekend

As well as adding doctrine/annotations as a suggestion in composer.json, I think it’d be nice for DX to use the container’s willBeAvailable method and throw an exception during compilation if the configuration is set to use attributes or annotations and doctrine/annotations isn’t installed.

can you at least mention need for doctrine/annotations somewhere?

It’s mentioned here. I also pinned this issue this morning.

That’s true only for projects that use VichUploaderBundle with annotations or attributes (configurations with XML or YAML are not affected). Anyway, the problem of missing annotations library can be easily solved by suggesting it and updating the documentation.

The aim now is not to force projects using attributes to install the annotations library, that’s a bit weird (from the point of view of the users). It would be best if we could achieve it in a minor version.

That’s correct, the doctrine/orm package now comes with its own AttributeReader and doesn’t use doctrine/annotations: https://github.com/doctrine/orm/blob/ed56f42cd50a17fd00f601d57912f41769123134/lib/Doctrine/ORM/Mapping/Driver/AttributeReader.php

Seeing as this bundle requires PHP >= 8.1, it might be an idea to deprecate annotations support in the next minor release and remove it in a major release?