For what purpose i can use Buildview and finishView of symfony forms For what purpose i can use Buildview and finishView of symfony forms symfony symfony

For what purpose i can use Buildview and finishView of symfony forms


You can use buildView and finishView methods in your type to pass new view vars to the form template. You can pass stuff from form options or form data class for example.

Method buildView is run before children views are built so you cannot access child views there (then you should use finishView which are run after children views are built).

bulidView example

finishView example

second buildView example