I have a ParamterValue class which references ParamterDefinition class, by property ParamterValue->paramDef. I created ParamterValueType to build a form.
How can I access ParamterValue->paramDef object in a template? I just need it for some logic in rendering a form, I actually don't need to render ParamterDefinition, that's why I don't include paramDef form field in ParamterValueType. Even if I would, how could I access underling object from the form view field?
So the general situation here looks like this: I have an object which I want to create from a form, that object has a reference to another object which has data that are needed to render the form (but I don't need a widget for it, just some data to perform logic). Do I need to include that referenced object in ParamterValueType to get access to it or not?
I didn't quite understand what you're trying to do, but I think that creating a form extension or using global vars will get you there.
Take a look at
http://toni.uebernickel.info/2011/11/25/how-to-extend-form-fields-in-symfony2.html
to learn about form extensions and
http://blogsh.de/2012/01/04/how-to-write-host-aware-twig-templates-in-symfony/
to learn about global vars.
You can usually just do
Actually, this only works as of Symfony 2.1.