ReviewType::configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * (c) Lukasz D. Tulikowski <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace App\Form;
13
14
use App\Entity\Review;
15
use Symfony\Component\Form\AbstractType;
16
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
17
use Symfony\Component\Form\FormBuilderInterface;
18
use Symfony\Component\OptionsResolver\OptionsResolver;
19
20
class ReviewType extends AbstractType
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25 3
    public function buildForm(FormBuilderInterface $builder, array $options)
26
    {
27
        $builder
28 3
            ->add('body')
29 3
            ->add('rating')
30 3
            ->add('author')
31 3
            ->add('publicationDate', DateTimeType::class, [
32 3
                    'widget' => 'single_text',
33
                    'input' => 'datetime',
34
            ]);
35 3
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 3
    public function configureOptions(OptionsResolver $resolver)
41
    {
42 3
        $resolver->setDefaults([
43 3
            'data_class' => Review::class,
44
        ]);
45 3
    }
46
}
47