I was looking around for a solution, but I cannot find any in stackoverflow.
The following problem is that I want to pass an object to a twig template.
I have a class which extends the AbstractType of Symfony2 Core. Then I understood that I have to override the BuildView Method of my specific type to hand over the variable.
The buildView method looks like this:
/**
*
* @param FormView $view
* @param FormInterface $form
* @param array $options
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
parent::buildView($view, $form, $options);
$view->vars['test']='test';
}
When I try to access the variable in my twig file ({{test}}), it tells me variable test not found.
What do I misunderstand? Thanks for your help AS