-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Support passing EntityManager instances in "em" option #10157
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
Comments
I'm the one who detect the issue and ask @geoffrey-brier to report it. After debugging it, IMO, there is two possibilities to fix it.
|
Marked as feature request. |
@webmozart What would be your preference about my two propositions (allow an entity manager instance or only allow string)? I would prefer the first one :) |
Both, no? Doing otherwise would break BC. |
Yeah obviously... When I said the entity manager, I meant the old way (string/null/entity manager) :) I will provide a PR this week-end. |
Cool, thanks! :) |
…upport for em option (egeloen) This PR was merged into the 2.6-dev branch. Discussion ---------- [Bridge][Doctrine][Form] Add entity manager instance support for em option | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10157 | License | MIT | Doc PR | symfony/symfony-docs#4336 This PR allows to pass an explicit entity manager instance as em option. Commits ------- d84e3a8 [Bridge][Doctrine][Form] Add entity manager instance support for em option
Hi,
We are trying to replace a "entity" field by changing only options in an event subscriber.
So basically what we do is:
The problem is that it seems the
->getOptions()
returns the normalized options and not the original ones. Thus theem
option is normalized andem
is not a string anymore but the concrete entity manager.This is problematic because then the
DoctrineType
throws an exception because it only deals with strings or null values:I think that the code below should probably fix the problem:
What is your opinion?
The text was updated successfully, but these errors were encountered: