symfony-console-form
symfony-console-form copied to clipboard
Don't cast form->data to array if it's not iterable
- 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
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.
@matthiasnoback added a test case.
Sorry, I merged the other PR first. Can you take a look at the tests and make them pass?