symfony - Clearing form collection entirely -
i have issue symfony 2.6 form collections. removing elements collection works, when @ least 1 present. if last element removed dom (leaving collection container empty), no elements removed collection after handling request.
example:
i have form collection "children" , 2 children, "a" , "b". remove child "b" dom, save, removechild called, child removed. remove child "a", save, nothing happens - after refreshing form child still present. when dumping main entity after form has handled request, child present in it's collection well.
did have similar problem , found solution?
you can 2 methods :
- as in symfony doc : form collection doc
- or doctrine annotation : doctrine orphanremoval doc
but don't forget cascade={"remove"}
annotation
Comments
Post a Comment