RecurringBankAccountType::configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PH\Bundle\PayumBundle\Form\Type;
6
7
use PH\Bundle\PayumBundle\Model\RecurringBankAccount;
8
use Symfony\Component\Form\Extension\Core\Type\EmailType;
9
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
10
use Symfony\Component\Form\Extension\Core\Type\TextType;
11
use Symfony\Component\Form\FormBuilderInterface;
12
use Symfony\Component\OptionsResolver\OptionsResolver;
13
14
class RecurringBankAccountType extends BankAccountType
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function buildForm(FormBuilderInterface $builder, array $options)
20
    {
21
        parent::buildForm($builder, $options);
22
23
        $builder
24
            ->add('bic', TextType::class, [
25
                'label' => 'form.bank_account.bic',
26
            ])
27
            ->add('email', RepeatedType::class, [
28
                'type' => EmailType::class,
29
                'invalid_message' => 'form.bank_account.email.match',
30
                'first_options' => ['label' => 'form.bank_account.email.label'],
31
                'second_options' => ['label' => 'form.bank_account.email.repeat_label'],
32
            ])
33
        ;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function configureOptions(OptionsResolver $resolver)
40
    {
41
        $resolver
42
            ->setDefaults([
43
                'data_class' => RecurringBankAccount::class,
44
                'validation_groups' => ['ph_recurring_bank_account'],
45
                'label' => false,
46
                'translation_domain' => 'PayumBundle',
47
            ])
48
        ;
49
    }
50
}
51