Completed
Pull Request — master (#21)
by Daniel
02:09
created

GridFormFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Psi\Component\Grid;
6
7
use Psi\Component\Grid\Metadata\FilterMetadata;
8
use Psi\Component\Grid\Metadata\GridMetadata;
9
use Psi\Component\ObjectAgent\Capabilities;
10
use Psi\Component\ObjectAgent\Query\Composite;
11
use Psi\Component\ObjectAgent\Query\Expression;
12
use Symfony\Component\Form\Extension\Core\Type\FormType;
13
use Symfony\Component\Form\FormFactoryInterface;
14
use Symfony\Component\Form\FormInterface;
15
use Symfony\Component\OptionsResolver\OptionsResolver;
16
use Psi\Component\Grid\CellRegistry;
17
use Psi\Component\Grid\Form\Type\GridType;
18
19
class GridFormFactory
20
{
21
    const FORM_NAME = 'grid';
22
23
    private $formFactory;
24
    private $cellRegistry;
25
26
    public function __construct(
27
        FormFactoryInterface $formFactory
28
    ) {
29
        $this->formFactory = $formFactory;
30
    }
31
32 View Code Duplication
    public function createForm(GridMetadata $gridMetadata, \Traversable $collection): FormInterface
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
    {
34
        $formBuilder = $this->formFactory->createNamedBuilder(self::FORM_NAME, GridType::class, [
35
            'rows' => $collection, 
36
        ], [
37
            'grid_metadata' => $gridMetadata,
38
        ]);
39
40
        return $formBuilder->getForm();
41
    }
42
}
43