Firstly I'm a complete noobie with Symfony 2. The question sounds simple, if I try and put some context into why and how I need this it will start to get confusing.
In essence I've created a form, which I manually process, validate and insert using Doctrine etc. I am manually creating the form within a controller action (it's built dynamically from retrieved values from another object). I'm assuming there maybe better ways to do this, but as I'm new to Symfony and days of trawling the net, I can't see any solutions to what I need to do.
Therefore I'm not simply building a form against a class/entity etc and so I will manually need to add a CSRF token or some kind of protection.
In normal circumstances you would create the FormType and configure default options to have csrf_protection. Then a simple case of:
{{ form_widget(form._token) }}
and the csrf token is there.
As I'm dynamically building the form I am not sure how I can manually create a csrf token for my form. Has anyone had any experience of creating forms without a class and adding csrf protection?
Kind regards Paul Pounder