Completed
Push — master ( fcfa74...4ea0bb )
by Paweł
20s
created

CustomerGroupConfigurationType::getBlockPrefix()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\CoreBundle\Form\Type\Promotion\Rule;
13
14
use Sylius\Bundle\CustomerBundle\Form\Type\CustomerGroupCodeChoiceType;
15
use Sylius\Component\Resource\Repository\RepositoryInterface;
16
use Symfony\Component\Form\AbstractType;
17
use Symfony\Component\Form\FormBuilderInterface;
18
use Symfony\Component\Validator\Constraints\NotBlank;
19
use Symfony\Component\Validator\Constraints\Type;
20
21
/**
22
 * @author Michał Marcinkowski <[email protected]>
23
 */
24
final class CustomerGroupConfigurationType extends AbstractType
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function buildForm(FormBuilderInterface $builder, array $options)
30
    {
31
        $builder
32
            ->add('group_code', CustomerGroupCodeChoiceType::class, [
33
                'label' => 'sylius.form.promotion_rule.customer_group.group',
34
                'constraints' => [
35
                    new NotBlank(['groups' => ['sylius']]),
36
                    new Type(['type' => 'string', 'groups' => ['sylius']]),
37
                ],
38
            ])
39
        ;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getBlockPrefix()
46
    {
47
        return 'sylius_promotion_rule_customer_group_configuration';
48
    }
49
}
50