Pass array of options to form builder

This post is just to archive a solution I used to pass an option list, to create a selectbox. The code I used to create the form type:

The setDefaultOptions method makes sure you pass the array of options. If you don’t, it will throw an exception.

Leave a Reply

Your email address will not be published.