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

CustomerGroupConfigurationType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 4
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 12 1
A getBlockPrefix() 0 4 1
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