TicketType::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace BCRM\WebBundle\Form;
4
5
use BCRM\BackendBundle\Entity\Event\Registration;
6
use Symfony\Component\Form\AbstractType;
7
use Symfony\Component\Form\FormBuilderInterface;
8
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
9
10
class TicketType extends AbstractType
11
{
12
    public function buildForm(FormBuilderInterface $builder, array $options)
13
    {
14
        $builder
15
            ->setMethod('POST')
16
            ->add('email', 'email', array('label' => 'E-Mail', 'required' => true, 'attr' => array('placeholder' => '[email protected]')))
17
            ->add('name', 'text', array('label' => 'Name', 'required' => true, 'trim' => true, 'attr' => array('placeholder' => 'Max Musterman')))
18
            ->add('twitter', 'text', array('label' => 'Twitter-Handle', 'required' => false, 'trim' => true, 'attr' => array('placeholder' => '@max_mustermann', 'pattern' => '@[a-zA-Z0-9_]{1,15}')))
19
            ->add('tags', 'text', array('label' => 'Tags', 'required' => false, 'trim' => true, 'attr' => array('placeholder' => '#foo #bar', 'pattern' => '#[^\s]{1,25}( #[^\s]{1,25}){0,2}')))
20
            ->add('saturday', 'checkbox', array('label' => 'Samstag', 'required' => false))
21
            ->add('sunday', 'checkbox', array('label' => 'Sonntag', 'required' => false))
22
            ->add('type', 'choice', array('label' => 'Typ', 'required' => true, 'choices' => array(Registration::TYPE_NORMAL => 'Normal', Registration::TYPE_VIP => 'VIP', Registration::TYPE_SPONSOR => 'Sponsor'), 'expanded' => true))
23
            ->add('save', 'submit', array('label' => 'Absenden', 'attr' => array('class' => 'btn-primary')));
24
    }
25
26
    public function setDefaultOptions(OptionsResolverInterface $resolver)
27
    {
28
        $resolver->setDefaults(array(
29
            'data_class' => 'BCRM\BackendBundle\Entity\Event\Registration',
30
        ));
31
    }
32
33
    public function getName()
34
    {
35
        return 'registration';
36
    }
37
38
}
39