doctrine / orm

Doctrine Object Relational Mapper (ORM)
https://www.doctrine-project.org/projects/orm.html
MIT License
9.86k stars 2.5k forks source link

Incompatibility with "stof/doctrine-extensions-bundle" "translatable" extension #11424

Closed sebastien-confetti closed 2 months ago

sebastien-confetti commented 2 months ago

BC Break Report

Q A
BC Break yes
Version doctrine/orm 3.1
BC Break no
Version doctrine/orm 2.18

Summary

A semantic error occurs when using the #[Translatable] attribute in an entity.

Previous behavior

All goes well. No error is displayed.

Current behavior

The following error is displayed:

In AnnotationException.php line 36:

  [Semantical Error] The class "Doctrine\ORM\Mapping\MappedSuperclass" is not annotated with @Annotation.
  Are you sure this class can be used as annotation?
  If so, then you need to add @Annotation to the _class_ doc comment of "Doctrine\ORM\Mapping\MappedSuperclass".
  If it is indeed no annotation, then you need to add @IgnoreAnnotation("ORM\MappedSuperclass") to the _class_ doc comment of class Gedmo\Translatable\Entity\MappedSuperclass\AbstractTranslation.

make:migration [--formatted] [--configuration [CONFIGURATION]]

How to reproduce

After installing stof/doctrine-extensions-bundle

composer require stof/doctrine-extensions-bundle

And made the following changes to the project:

And then makes a:

php bin/console make:migration

The following error is displayed:

In AnnotationException.php line 36:

  [Semantical Error] The class "Doctrine\ORM\Mapping\MappedSuperclass" is not annotated with @Annotation.
  Are you sure this class can be used as annotation?
  If so, then you need to add @Annotation to the _class_ doc comment of "Doctrine\ORM\Mapping\MappedSuperclass".
  If it is indeed no annotation, then you need to add @IgnoreAnnotation("ORM\MappedSuperclass") to the _class_ doc comment of class Gedmo\Translatable\Entity\MappedSuperclass\AbstractTranslation.

make:migration [--formatted] [--configuration [CONFIGURATION]]

This is my first issue. If I've made any mistakes in this one, I apologize.

mbabker commented 2 months ago

This is not a bug with the ORM.

You are trying to use the gedmo/doctrine-extensions package alongside ORM 3.x, and this package is not yet compatible with the new ORM version.