When you want to bind data to form (for example in your REST application) as in FOSRestBundle, but after handleRequest() you doesn't have submitted data, try to map it with
$this->get('form.factory')->createNamed('', MyFormType::class, $dummy, ['csrf_protection' => false]);
, where first parameter is empty string, the second is form, $dummy is for model or entity object. So you can use form validation in simple Symfony action.
$this->get('form.factory')->createNamed('', MyFormType::class, $dummy, ['csrf_protection' => false]);
, where first parameter is empty string, the second is form, $dummy is for model or entity object. So you can use form validation in simple Symfony action.
Комментариев нет:
Отправить комментарий