Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

forms

php

symfony

I tried hard but still could not get , for what purpsoe , i can use buildview and finish view in symfony2.

can someone please give me some simple example how can use it.

I am trying to learn symfony by using all its functions

like image 498
Mirage Avatar asked Aug 27 '12 11:08

Mirage


1 Answers

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

like image 95
l3l0 Avatar answered Oct 08 '22 11:10

l3l0