Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sebastien-confetti opened this issue Apr 25, 2024 · 1 comment

Comments

@sebastien-confetti
Copy link

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:

  • doctrine.yaml
doctrine:
    dbal:
         ...
    orm:
        ...
    mappings:
       App:
           ...
       gedmo_translatable:
           type: attribute
           prefix: Gedmo\Translatable\Entity
           dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/src/Translatable/Entity"
           alias: GedmoTranslatable # (optional) it will default to the name set for the mapping
           is_bundle: false
    ...
  • TheEntity.php
<?php
namespace App\Entity;
...
use Gedmo\Mapping\Annotation\Translatable;
...
class TheEntity
{
    ...
    #[Translatable]
    private string $title = '';
    ...
}

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
Copy link
Contributor

mbabker commented Apr 25, 2024

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.

@greg0ire greg0ire closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants