-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
Error in XML mapping (gedmo) afer upgrade to 2.9 #1643
Comments
you are using DoctrineBundle, right? Can you check if this is fixed if you revert back to |
That's right, in DoctrineBundle v2.8.3 everything is ok |
Its caused by enabling strict XSD validation by default on DoctrineBundle We decided to not make it configurable for now by adding yet another config option. Can this issue be resolved instead by making the XML valid for this XSD validation? cc @ostrolucky |
We @sulu are running into the same problem. Here is our
I think the validation is failing because Here is our XML: https://github.com/sulu/sulu/blob/08a40b7de9c1b3f9a6c42edc928ee8e4ff9ea97c/src/Sulu/Bundle/MediaBundle/Resources/config/doctrine/Collection.orm.xml#L5 It follows the gedmo docs and: xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping" Is added but still seems failing. As already mention the enabled validation here seems be the problem: |
Transferring to the correct repository. Also, not sure if this is going to fix your issue @alexander-schranz but I'd recommend you use |
Same problem in @Sylius 🙋🏼♂️. |
@jakubtobiasz noted, but please, let's not pile up +1s here, and focus on getting to a solution instead. If you want to +1, you have reactions. A way forward could be to disable XSD validation in a patch release of the doctrine bundle, then expose a configuration node in the next minor release, and deprecate not setting it to |
Gedmo has wrong schema, it should be fixed there. Adding config option that we have to keep around for 2 major releases just because of deprecations is precisely what we wanted to avoid. |
@ostrolucky I understand your move from a maintainer perspective, but from a user perspective it's a troublemaker. In should be introduced with a switch or postponed until the next major release IMO. For now, it'd be great to have an option to disable it. |
DoctrineBundle should not force users to enable the XSD validation if they are not compatible with it yet. Otherwise, it effectively turns the ORM deprecation into a BC break. The fact that the doctrine extensions need to change the way to configure their mapping is reported at doctrine-extensions/DoctrineExtensions#2318 already, but there is not yet an alternative. |
You wouldn't complain if symfony validation constraint validator is extended to cover some edge case, would you? BC break is matter of opinion. Every bug fix is a BC break for people relying on that bug and invalid schema looks like a bug to me, we just opted to stop supporting that to make people fix those. Link above where it was reported already in 2021 that gedmo is relying on invalid schema and nothing was done about it is a proof it won't be fixed until it's necessary. Anyways if someone works on such option in bundle I will merge it, but wouldn't it be easier to fix gedmo? |
@ostrolucky the ORM introduces this change as a opt-in precisely because it is known that this change has a BC impact. the way the bundle handled it is to force the new behavior in a minor version of the bundle, effectively ignoring the decision of the ORM maintainers to make it opt-in for BC reasons. gedmo being a widely used package impacted by the ORM change was a known thing, which is why it was opt-in. And before ORM 2.10, the ORM XSD was explicitly allowing to have nodes from different namespaces in those places, so the gedmo decision (done at the time of ORM 2.0) cannot be considered a bug in gedmo (they rely on a feature that has been deprecated 10 years after they started using it). And even if Gedmo is fixed, this won't magically solve things: projects will need to migrate to the new way of configuring gedmo before enabling the ORM validation (and AFAIK, nobody is working yet on implementing such new configuration format in gedmo). |
There are several options:
|
@ostrolucky Defining a standalone XML schema in gedmo implies that the gedmo config should be in a separate XML file than the ORM mapping. That's precisely what requires changing the way gedmo is configured. And this will take time and will require projects using gedmo to migrate to the new configuration system using separate files. Moving the code to the bridge will not solve the fact that without exposing a configuration setting, you still force users to use the new ORM behavior which is a BC break.
Well, this is a way that is regularly used in Symfony's core bundles when we need projects to opt in for a new behavior.
This option could work, but I'm not sure how feasible it is for the ORM. That's an interesting idea as it would report deprecations only for projects that have an invalid XML configuration according to the new XSD. |
I don't think Symfony ends up being in situation where you have config options related to external libraries that don't do anything anymore (because those options don't exist in newer versions of those libraries but both versions still need to be supported). Anyways I'm well aware of how Symfony does it, doctrine-bundle is not required to follow same policies though. But like I said, if someone creates MR for this, it's fair enough. |
I propose a solution:
A solution similar to what Symfony does in |
@eisberg that's not a solution, given that the goal of ORM maintainers is to stop allowing to add external nodes in XML mapping files (otherwise, they would not have removed support for using external nodes in the ORM XSD. What we need here is a proper deprecation path, not a new feature that does the opposite of that deprecation. |
I'll reiterate what I think is the best course of action:
Having many unused nodes is a big deal because we don't do major releases often. That's what should IMO change. |
By the way, I just realized that the best value for this validation setting is probably So new plan:
|
I propose to revert it with a patch release first: #1644 Then we can think about how to tackle it properly |
BC Break Report
Summary
i get error after upgrade this version.
Problem in PR: doctrine/orm#10579
see comments in issue: doctrine/orm#10552
The text was updated successfully, but these errors were encountered: