Completed
Pull Request — master (#304)
by Piotr
07:23
created

CustomSubscriber   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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