Completed
Pull Request — master (#347)
by Łukasz
17:04
created

CustomSubscriber::initDataGrid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FSi\FixturesBundle\Admin;
6
7
use FSi\Bundle\AdminBundle\Doctrine\Admin\ListElement;
8
use FSi\Component\DataGrid\DataGridFactoryInterface;
9
use FSi\Component\DataGrid\DataGridInterface;
10
use FSi\Component\DataSource\DataSourceFactoryInterface;
11
use FSi\Component\DataSource\DataSourceInterface;
12
use FSi\FixturesBundle\Entity;
13
14
class CustomSubscriber extends ListElement
15
{
16
    public function getId(): string
17
    {
18
        return 'custom_subscriber';
19
    }
20
21
    public function getClassName(): string
22
    {
23
        return Entity\Subscriber::class;
24
    }
25
26
    protected function initDataGrid(DataGridFactoryInterface $factory): DataGridInterface
27
    {
28
        return  $factory->createDataGrid(Subscriber::ID);
29
    }
30
31
    protected function initDataSource(DataSourceFactoryInterface $factory): DataSourceInterface
32
    {
33
        return $factory->createDataSource(
34
            'doctrine-orm',
35
            ['entity' => $this->getClassName()],
36
            Subscriber::ID
37
        );
38
    }
39
}
40