DictionaryDataSet   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 26
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getIdentifier() 0 4 1
A configureOptions() 0 9 1
A createQueryBuilder() 0 8 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
13
namespace WellCommerce\Bundle\AppBundle\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 DictionaryDataSet
21
 *
22
 * @author Adam Piotrowski <[email protected]>
23
 */
24
class DictionaryDataSet extends AbstractDataSet
25
{
26
    public function getIdentifier(): string
27
    {
28
        return 'admin.dictionary';
29
    }
30
    
31
    public function configureOptions(DataSetConfiguratorInterface $configurator)
32
    {
33
        $configurator->setColumns([
34
            'id'          => 'dictionary.id',
35
            'identifier'  => 'dictionary.identifier',
36
            'translation' => 'dictionary_translation.value',
37
            'locale'      => 'dictionary_translation.locale',
38
        ]);
39
    }
40
    
41
    protected function createQueryBuilder(): QueryBuilder
42
    {
43
        $queryBuilder = $this->repository->getQueryBuilder();
44
        $queryBuilder->groupBy('dictionary.id');
45
        $queryBuilder->leftJoin('dictionary.translations', 'dictionary_translation');
46
        
47
        return $queryBuilder;
48
    }
49
}
50