Skip to content
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

Don't cast form->data to array if it's not iterable #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

oleg-andreyev
Copy link
Contributor

  • Form Data may be not iterable, so need to throw an exception if data is not iterable
  • When working with ArrayCollection it's already iterable, so need to cast to array

@matthiasnoback
Copy link
Owner

Thanks for making this PR. What's missing for me is a test case that shows when this is indeed a problem. I understand why you need this, but I want to ensure that the feature "this library works with iterables in general" also keeps working in the future, etc. So can you take a look at the tests and add a form type that shows how you're using a form field with a collection? Feel free to add doctrine/collections as a dev dependency, so you can mimic a real-world scenario.

@oleg-andreyev
Copy link
Contributor Author

@matthiasnoback added a test case.

@matthiasnoback
Copy link
Owner

Sorry, I merged the other PR first. Can you take a look at the tests and make them pass?

@oleg-andreyev oleg-andreyev force-pushed the dont-cast-form-data-to-array-if-its-not-iterable branch from c0dd5db to 3f9f4b4 Compare December 5, 2020 18:39
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