Completed
Push — master ( 7a9a35...ef55ea )
by Adam
06:26
created

ProducerCollectionDataGrid   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 6
dl 0
loc 39
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B configureColumns() 0 27 1
A getIdentifier() 0 4 1
1
<?php
2
/*
3
 * WellCommerce Open-Source E-Commerce Platform
4
 *
5
 * This file is part of the WellCommerce package.
6
 *
7
 * (c) Adam Piotrowski <[email protected]>
8
 *
9
 * For the full copyright and license information,
10
 * please view the LICENSE file that was distributed with this source code.
11
 */
12
namespace WellCommerce\Bundle\CatalogBundle\DataGrid;
13
14
use WellCommerce\Bundle\CoreBundle\DataGrid\AbstractDataGrid;
15
use WellCommerce\Component\DataGrid\Column\Column;
16
use WellCommerce\Component\DataGrid\Column\ColumnCollection;
17
use WellCommerce\Component\DataGrid\Column\Options\Appearance;
18
use WellCommerce\Component\DataGrid\Column\Options\Filter;
19
use WellCommerce\Component\DataGrid\Column\Options\Sorting;
20
21
/**
22
 * Class ProducerCollectionDataGrid
23
 *
24
 * @author  Rafał Martonik <[email protected]>
25
 */
26
class ProducerCollectionDataGrid extends AbstractDataGrid
27
{
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function configureColumns(ColumnCollection $collection)
32
    {
33
        $collection->add(new Column([
34
            'id'         => 'id',
35
            'caption'    => 'common.label.id',
36
            'sorting'    => new Sorting([
37
                'default_order' => Sorting::SORT_DIR_DESC,
38
            ]),
39
            'appearance' => new Appearance([
40
                'width'   => 90,
41
                'visible' => false,
42
            ]),
43
            'filter'     => new Filter([
44
                'type' => Filter::FILTER_BETWEEN,
45
            ]),
46
        ]));
47
        
48
        $collection->add(new Column([
49
            'id'      => 'name',
50
            'caption' => 'common.label.name',
51
        ]));
52
        
53
        $collection->add(new Column([
54
            'id'      => 'producerName',
55
            'caption' => 'common.label.producer',
56
        ]));
57
    }
58
    
59
    public function getIdentifier(): string
60
    {
61
        return 'producer_collection';
62
    }
63
    
64
}
65