Closed leevigraham closed 13 years ago
In order to render the template of collection we uses the "$$name$$" reference (https://github.com/beberlei/AcmePizzaBundle/blob/master/Resources/views/Order/index.html.twig#L35) but as of RC5, this entry is not available anymore.
I'll try to find a way to bypass this restriction...
here is the pr which introduced the "bug" https://github.com/symfony/symfony/commit/257f86cb204ed8da781a7a8160381eac5355c91e
RC5 renders the prototype in the data-prototype attribute of the form element. Outputting {{ form_widget(your_form) }} demonstrates this. I'm currently re-readings the form documentation to see how to customise the twig output. Like I said I'm still a noob :D
@leevigraham this commit https://github.com/beberlei/AcmePizzaBundle/commit/7ae6d8312eb66800fba8bd5da7def8e5bde89842 solves this issue
Thanks for that. Did you figure it out by looking directly at the code or by following some documentation? I'd love to learn the best way to debug Symfony 2 issues.
I'm not sure this was the best way, but I've noticed that prototype form was recorded as an attribute of "form.items" and FormView class allows a "get" method... tried and this worked, obviously there is no documentation to customize prototype rendering...
This could be a nice cookbook but maybe form is not stable enough ;)
I'm still learning how to best implement collections w/ allow_add, allow_delete and protoytype so I can't provide a pull request.
Looks like the way the collection fieldtype works has changed. Here's the error:
Key "$$name$$" in object (with ArrayAccess) of type "Symfony\Component\Form\FormView" does not exist in "AcmePizzaBundle:Order:index.html.twig" at line 36
Cheers Leevi