Skip to content

Remove paragraph about doctrine mapping override #14152

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

Merged
merged 1 commit into from
Sep 7, 2020

Conversation

l-vo
Copy link
Contributor

@l-vo l-vo commented Aug 31, 2020

Hello,

I would suggest to remove the paragraph about mapping override because it doesn't work in all cases.

I read the related PR (#10053) and the issue (#7076) which motivated it. The example in the issue works only because auto_mapping is set to true (auto_mapping: true allows to find definitions in `Resources/config/doctrine/*.orm.{xml, yml, php} of all the bundles even if nothing is declared in the bundles).

From the POV of the bundle , it's IMHO not a good practice to rely on app auto_mapping configuration (the trend for sf4 and sf5 is to rely on configurations over conventions).

So when bundle mapping rely on the dedicated compiler pass (example here) and not on auto_mapping app configuration , the mapping definition file in the compiler pass (from the bundle) overrides the mapping definition file defined in the application.

@javiereguiluz
Copy link
Member

I don't know if we should remove this paragraph or not (some Doctrine experts will need to help us here). But if we remove it ... then we need to add some content saying that it's not possible to override that config. The current docs say "you can do XXX" ... so if it's not possible, we should say "you CANNOT do XXX" instead of deleting the original phrase.

Because this solution only works if the bundle relies on auto_mapping. IMHO a bundle should add mapping via the dedicated compiler pass and not rely on the application configuration (`auto_mapping: true` in this case).
@l-vo
Copy link
Contributor Author

l-vo commented Sep 3, 2020

@javiereguiluz thank you for you feedback. I tweaked the update to underline the can/cannot idea (actually, the second paragraph explains it's possible via mapped superclasses, so I replaced "cannot" by "can only"). Now let's wait for Doctrine experts feedback :)

@javiereguiluz javiereguiluz added this to the 3.4 milestone Sep 7, 2020
@javiereguiluz javiereguiluz merged commit 4ef0ab0 into symfony:3.4 Sep 7, 2020
@javiereguiluz
Copy link
Member

Thanks Laurent! Merged.

@l-vo
Copy link
Contributor Author

l-vo commented Sep 7, 2020

@javiereguiluz great :) Have you had any confirmation from a Doctrine expert ?

@l-vo l-vo deleted the patch-13 branch September 7, 2020 18:43
@javiereguiluz
Copy link
Member

I haven't, but we need to be more proactive when merging things because we have tons of pending things to do.

@l-vo
Copy link
Contributor Author

l-vo commented Sep 7, 2020

Ok I understand, thank you. I tested what I wrote anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants