Completed
Push — master ( d67f41...79042b )
by Adam
07:27
created

NewsCategoryDataSet::getIdentifier()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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
13
namespace WellCommerce\Bundle\CmsBundle\DataSet\Admin;
14
15
use Doctrine\ORM\QueryBuilder;
16
use WellCommerce\Bundle\CoreBundle\DataSet\AbstractDataSet;
17
use WellCommerce\Component\DataSet\Configurator\DataSetConfiguratorInterface;
18
19
/**
20
 * Class NewsCategoryDataSet
21
 *
22
 * @author  Adam Piotrowski <[email protected]>
23
 */
24
class NewsCategoryDataSet extends AbstractDataSet
25
{
26
    public function getIdentifier(): string
27
    {
28
        return 'admin.news_category';
29
    }
30
    
31
    public function configureOptions(DataSetConfiguratorInterface $configurator)
32
    {
33
        $configurator->setColumns([
34
            'id'   => 'news_category.id',
35
            'name' => 'news_category_translation.name',
36
        ]);
37
    }
38
    
39
    protected function createQueryBuilder(): QueryBuilder
40
    {
41
        $queryBuilder = $this->repository->getQueryBuilder();
42
        $queryBuilder->leftJoin('news_category.translations', 'news_category_translation');
43
        $queryBuilder->groupBy('news_category.id');
44
        
45
        return $queryBuilder;
46
    }
47
}
48