-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add options in listeners: forceUseAttributeReader and separateXmlMapping #2657
base: main
Are you sure you want to change the base?
Conversation
b82af95
to
f5bd260
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2657 +/- ##
==========================================
+ Coverage 78.75% 79.62% +0.87%
==========================================
Files 163 161 -2
Lines 8593 8478 -115
==========================================
- Hits 6767 6751 -16
+ Misses 1826 1727 -99 ☔ View full report in Codecov by Sentry. |
f5bd260
to
32b7a81
Compare
32b7a81
to
21c9693
Compare
21c9693
to
c93ea15
Compare
I have to be honest, the more I think about this PR, the more I'm not sure I agree with it. While the XSD validation issue is a legitimate concern (and one the ORM maintainers took into account before releasing 3.0 by reverting the mandatory validation, and the MongoDB ODM maintainers closely following the relevant ORM issues), I think both ideas proposed in this PR just makes things more complicated from an end user and a maintainer perspective. One of the biggest benefits to piggybacking off the Doctrine mapping API is all of the problems they've already solved are solved for us. Separating out the mapping (either through separate XML configs or having models with XML definitions and requiring PHP attributes to add this package's functionality) seems like it would re-introduce a lot of those kinds of solved problems. How well does this PR account for models with inheritance (which is a big thing in the Sylius ecosystem where model schemas are defined with XML, and is functionality provided through this package with a number of mapped superclasses)? If this PR is to move forward, it will need a lot of tests covering this behavior as it is a huge behavioral change if you opt into either of these features. |
There is nothing self-written in this solution, only (1) the doctrine XMLReader is launched for separate files OR (2) the standard doctrine AttributeDriver is launched instead of the one installed in the general configuration. Well, besides, when these options are disabled, the standard behavior is preserved. It's just a configuration manipulation of which reader to use. We have been successfully using the patch from this PR for a year now, in a product that has about 1000 ORM models. Well, this is just a little confirmation that it works. Convert all our ORMs to attributes, only because DoctrineExtension does not support XML, or rather, Doctrine forbade writing something third-party, dubious activity in its files. PS: During the year of the known problem, no alternative was proposed |
c93ea15
to
3b0553f
Compare
Add other PR: #2845 |
Closes #2613 and #2318
1. Mapping Driver: Configure usage separately with Doctrine
.orm.xml
->.gedmo.xml
filesThanks to this option, we can transfer options related to setting up Gedmo properties from a common configuration file with the doctrine to a separate EnittyName file.gedmo.xml !
Example MyEntity.gedmo.xml:
Default value: FALSE
2. Alternative option: force the use of AttributeReader and ignore the configuration of the Doctrine chain driver
After that, the Gedmo options will be read from the attributes, despite the fact that the basic configuration of the mapping doctrine is read in XML files
Default value: FALSE