I am using Symfony2 with Doctrine and Twig. I have two forms created in this way:
class PaymentsType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder->add('date', 'date', array('widget' => 'single_text', 'format' => 'yyyy-MM-dd', 'required' => false));
// ...
}
public function getName()
{
return 'payments';
}
}
The second is similar but getName() returns ‘edit’
Each of the has its own submit button. How can I get the name of the form whose submit button was pressed? The thing I want to do is to find a way the controller to identify which button was pressed because each of them should make different things happen.
The following should work: