Completed
Push — master ( 61c842...2ec63c )
by Paweł
293:00 queued 278:23
created

ProductType::buildForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 2
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\ProductBundle\Form\Type;
13
14
use Sylius\Bundle\ProductBundle\Form\EventSubscriber\ConfigurableProductSubscriber;
15
use Sylius\Bundle\ResourceBundle\Form\EventSubscriber\AddCodeFormSubscriber;
16
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
17
use Symfony\Component\Form\FormBuilderInterface;
18
19
/**
20
 * @author Paweł Jędrzejewski <[email protected]>
21
 * @author Gonzalo Vilaseca <[email protected]>
22
 */
23
class ProductType extends AbstractResourceType
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function buildForm(FormBuilderInterface $builder, array $options)
29
    {
30
        $builder
31
            ->add('masterVariant', 'sylius_product_variant', [
32
                'master' => true,
33
            ])
34
            ->addEventSubscriber(new AddCodeFormSubscriber())
35
            ->addEventSubscriber(new ConfigurableProductSubscriber())
36
        ;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getName()
43
    {
44
        return 'sylius_product';
45
    }
46
}
47