-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form][2.8] Type "entity" not setting selected data when choice_value is a string attribute #17271
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
Why do you want to change the |
thank you for the quick response 👍 I thought it should be able to find entries by given |
What is the advantage of that instead of just using the id? |
When you use For example See the difference? |
I understand your use case, but I do not think that a choice or entity type is what you should use for that imo. |
The entity tyoe is using the primary key to look up the doctrine entity which of course won't find it with |
I used a query builder as follows but I had no luck:
|
This issue should be reopened until #17694 is merged. This is a bug of |
…pe (HeahDude) This PR was merged into the 2.7 branch. Discussion ---------- [2.7] [DoctrineBridge] [Form] fix choice_value in EntityType | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17693, #17271, #13964 | License | MIT | Doc PR | symfony/symfony-docs#6260 Commits ------- 2336d5c fix choice_value option in EntityType and add some tests
Having this feature working would be a nice thing. I was dealing with the same issue. Meanwhile, a workaround solution would be using Data View Transformers http://symfony.com/doc/current/cookbook/form/data_transformers.html |
@igorpaladino it fixed by #17694 and #17990 as of 2.7.11, 2.8.4 and 3.0.4. Note that using a custom |
I have been going nuts trying to solved this problem, to find out is a bug, Using a the work around is just overkill, I solved the issue with jquery. |
I have the following code:
When I select a category it does not give me the selected category entity, but when I changed
choice_value
to beid
it worked fine. There seem to be an issue when thechoice_value
is a string attributeNOTE:
Ras\Bundle\DomainBundle\Entity\Category
entity has following attributes:id, name, label
The text was updated successfully, but these errors were encountered: