Completed
Push — master ( e66c58...0a0a0f )
by Daniel
9s
created

SelectColumn::getParent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Psi\Component\Grid\Column;
6
7
use Psi\Component\Grid\ColumnInterface;
8
use Psi\Component\Grid\View\Cell;
9
use Psi\Component\ObjectAgent\AgentFinder;
10
use Symfony\Component\OptionsResolver\OptionsResolver;
11
12
class SelectColumn implements ColumnInterface
13
{
14
    const INPUT_NAME = '_select';
15
16
    private $agentFinder;
17
18
    public function __construct(AgentFinder $agentFinder)
19
    {
20
        $this->agentFinder = $agentFinder;
21
    }
22
23
    public function buildCell(Cell $cell, array $options)
24
    {
25
        $cell->template = 'Select';
26
27
        // TODO: maybe use the property accessor here instead? and default to the property "id".
28
        $agent = $this->agentFinder->findFor(get_class($cell->context));
29
30
        $cell->value = $agent->getIdentifier($cell->context);
31
    }
32
33
    public function configureOptions(OptionsResolver $options)
34
    {
35
        $options->setDefault('property', null);
36
    }
37
38
    public function getParent()
39
    {
40
    }
41
}
42