I tried hard but still could not get , for what purpsoe , i can use buildview and finish view in symfony2.
我努力但仍然无法得到,对于什么purpsoe,我可以使用buildview并在symfony2中完成视图。
can someone please give me some simple example how can use it.
有人可以给我一些简单的例子如何使用它。
I am trying to learn symfony by using all its functions
我试图通过使用它的所有功能来学习symfony
22
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.
您可以在类型中使用buildView和finishView方法将新视图变量传递给表单模板。例如,您可以从表单选项或表单数据类传递内容。
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).
方法buildView在构建子视图之前运行,因此您无法在那里访问子视图(那么您应该使用在构建子视图之后运行的finishView)。
bulidView示例
finishView示例
第二个buildView示例
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2012/08/27/5383a31ecd804232de80d85d59ee102a.html。