Giter VIP home page Giter VIP logo

Comments (7)

mbabker avatar mbabker commented on August 14, 2024 3

I don't know what make:migration does under the hood, but without a full stack trace pointing to what annotation(s) from what file(s) are trying to be read, it's hard to do anything but point to random GitHub repositories or random commits that have nothing to do with this specific error.

For the folks hitting that annotation-related error when having gedmo/doctrine-extensions installed at a minimum (whether that be your application added it explicitly or you're using StofDoctrineExtensionsBundle which integrates that library), the technical reason for it is that when an annotation or attribute reader is not explicitly injected into the extensions library's Doctrine event listeners, it will default to creating a generic Doctrine\Common\Annotations\AnnotationReader instance if the doctrine/annotations library is installed, and only attempts to create an attribute reader if running PHP 8 and the annotations library is not installed. The extensions library knows nothing about whether it's running inside a Symfony 7 application or in some other application integrating one of the Doctrine object managers, so it can't just magically change behaviors because of a framework being present.

For folks getting any kind of [Semantical Error] The class "Doctrine\ORM\Mapping\*" is not annotated with @Annotation. error, this generally means that you are running ORM 3.x (which dropped support for annotations) and something in your application is still parsing annotations. Whether that be through explicit configuration or some kind of fallback behavior (like the one I've described in the extensions library) is hard to say, but that is ultimately the reason for it, and this probably indicates that you're trying to use dependencies at versions that are not compatible with one another.

The symfony/symfony#48792 issue is specific to the Symfony DependencyInjection component and its handling of the older @required annotation alongside the newer #[Required] attribute; the fix for it is not a one-size-fits-all solution for every PHP file that has both annotations and attributes. So shooting off PRs that remove the annotations is just not going to be helpful as doing so will break backward compatibility for downstream users relying on annotation-based configuration.

from reset-password-bundle.

KhorneHoly avatar KhorneHoly commented on August 14, 2024 1

Hi @jrushlow.

The issue occurs for me with Symfony 6.4 while using the Stof DoctrineExtensions. As soon as I add this to my stof_doctrine_extensions.yaml, the same error occurs.

stof_doctrine_extensions:
    default_locale: en_US
    orm:
        default:
            loggable: true

There is an issue for this error on their project as well, but I'm not certain what causes this error: stof/StofDoctrineExtensionsBundle#470

Edit 1: Seems like the DoctrineExtensions isn't ready to be used with Doctrine 3 yet. As I haven't had issues with the RestPasswordBundle until I've added the DoctrineExtensions, the error message most likely displays an confusing text.

Edit 2: Downgrading doctrine/orm from 3.1.* to 2.19.* fixed this issue. It's a none issue for the RestPasswordBundle, but might be worth a notice for future reference, until DoctrineExtensions are ready for Doctrine 3.

from reset-password-bundle.

KhorneHoly avatar KhorneHoly commented on August 14, 2024 1

Sure thing @jrushlow, here are the links.

composer.json: https://gist.github.com/KhorneHoly/4b88b1a066d494195adff309bb246ad5
composer.lock: https://gist.github.com/KhorneHoly/3a94d7383014fdabe408ad3beb6bcd14

from reset-password-bundle.

jrushlow avatar jrushlow commented on August 14, 2024

@xribant - I'm not able to reproduce this error on a fresh symfony install. Can you provide:

  1. the exact steps used to create the new symfony 7 app
  2. your composer.json - at the very least the require && require-dev sections of the file
  3. the contents of config/packages/doctrine.yaml - specifically the doctrine.orm configuration

I would suspect this is caused by the doctrine config being set to use annotations rather than attributes.

When I do:

  1. symfony new --webapp --docker ./app-test-287
  2. bin/console make:user (Yes to defaults)
  3. bin/console make:reset-password (Yes to defaults)
  4. bin/console make:migration

I'm getting a success message with a generated migration file.

from reset-password-bundle.

jrushlow avatar jrushlow commented on August 14, 2024

Howdy @KhorneHoly - can you create a gist of your composer.json && composer.lock file for me (when the error occurred)? I'd like to dig into this a bit more, but I don't have much to go on in order to reproduce the error.

from reset-password-bundle.

featuriz avatar featuriz commented on August 14, 2024

I faced the same now.
To be noted for this bundle developers(and all other bundle developers as well)
I found the solution here: symfony/symfony#48792

Solution:: remove double required annotation + attributes

from reset-password-bundle.

featuriz avatar featuriz commented on August 14, 2024

@mbabker

So shooting off PRs that remove the annotations is just not going to be helpful as doing so will break backward compatibility for downstream users relying on annotation-based configuration.

You are right.

from reset-password-bundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.