Skip to content

Implement setting data retrieved from TranslationsFormsType back to FormType#404

Closed
tobias-93 wants to merge 1 commit intoa2lix:mainfrom
tobias-93:patch-1
Closed

Implement setting data retrieved from TranslationsFormsType back to FormType#404
tobias-93 wants to merge 1 commit intoa2lix:mainfrom
tobias-93:patch-1

Conversation

@tobias-93
Copy link
Contributor

When retrieving data from the TranslationsFormsType, an ArrayCollection is retrieved. However, when setting that data on the form again it didn't work. Using this change the data will be mapped back to the form fields.

@tobias-93 tobias-93 force-pushed the patch-1 branch 2 times, most recently from 5dd0f69 to ea0345b Compare February 17, 2026 19:55
@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.31%. Comparing base (7289c49) to head (9c73e23).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #404      +/-   ##
============================================
+ Coverage     54.88%   55.31%   +0.42%     
  Complexity       80       80              
============================================
  Files            10       10              
  Lines           317      320       +3     
============================================
+ Hits            174      177       +3     
  Misses          143      143              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@webda2l
Copy link
Member

webda2l commented Feb 25, 2026

@tobias-93
Copy link
Contributor Author

For mapped entities that works, but the TranslationsFormsType is explicitly meant for non-mapped model classes. Currently the type only works one way, it will give you the submitted data in a structured way (ArrayCollection) but if you want to give feedback to the user or preset data there is no way. This PR fixes that so the form accepts the data in the same way it provides it after submit.

@webda2l
Copy link
Member

webda2l commented Feb 26, 2026

For mapped entities that works, but the TranslationsFormsType is explicitly meant for non-mapped model classes. Currently the type only works one way, it will give you the submitted data in a structured way (ArrayCollection) but if you want to give feedback to the user or preset data there is no way. This PR fixes that so the form accepts the data in the same way it provides it after submit.

TranslationsFormsType is not explicitly meant for non-mapped model classes no, and it was designed to use the ArrayCollection key feature (I fixed an inconsistency related to this in https://github.com/a2lix/TranslationFormBundle/pull/405/changes#diff-496b9cf15d4e9bdd672bcf9aefade72eeba0bf8868fa2686810fe6809581e56cR75). It should not block your usage if you respect its intended behavior.
Adding an extra loop over the Collection getter in this PR, when the data is directly accessible if used correctly, does not seem right to me.
Feel free to reproduce your case using the a2lix/Demo project if you really can’t make it work.

@webda2l webda2l closed this Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants