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

ProducerCollectionDataGrid::configureColumns()   B

Complexity

Conditions 1
Paths 1

Duplication

Lines 0
Ratio 0 %

Size

Total Lines 27
Code Lines 17

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 17
nc 1
nop 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