Answer the question
In order to leave comments, you need to log in
How to create symfony form in standalone case using form component?
Есть класс формы
class SignInForm extends AbstractType
{
public function
buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('login')
->add('password')
->add('save', 'submit');
}
public function getName()
{
return 'signin';
}
}
как его привязать к entity и отправить на рендер?
что-то вроде
$form = $formFactory->create(new SignupForm(), $user);
$view->form = $form->createView();
Answer the question
In order to leave comments, you need to log in
Everything about forms is written in the documentation: symfony.com/doc/current/book/forms.html#book-form-...
In the controller, create a form right away:
$form = $this->createForm(new SignInForm(), null, array(
'action' => $this->generateUrl('login_check'),
'method' => 'POST',
));
$form = $this->createForm(new SignInForm());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question