Bug #5161 Disallow clear in AssociationField when field is required#6740
Conversation
cdce974 to
5e4f5b0
Compare
|
@Sobak thanks for this contribution. I don't mind the trait extending solution ... but I was wondering, shouldn't we instead add the new code line below these two lines? EasyAdminBundle/src/Field/Configurator/CommonPreConfigurator.php Lines 65 to 66 in 8e2c268 |
|
Hi @javiereguiluz, thanks for the quick review. I didn't feel confident enough with the project to suggest such solution, I don't know for sure if it's going to cause some backwards incompatible changes, but if you say it's a sensible behavior for all field types, then I'll update this PR momentarily. |
5e4f5b0 to
20ff3e4
Compare
|
Done, I force-pushed the commit. I also tested your suggested change with my project manually and it works like expected for |
|
Nice! I tested this on my apps and everything worked as expected, so I think it's safe to merge it. Thanks for your contribution! |
Hi,
This small change closes #5161 and instructs the frontend library to not render the
xbutton for unsetting the association completely.Admittedly, "extending" the trait methods in PHP is always weird and it's not very common, but it allows for the least amount of code repetition. This approach also doesn't require any JS changes. Please let me know if such approach is acceptable. This is my first contribution so there might be some other rules that I'm not aware of.
Thanks!