Completed
Push — master ( 6b87b2...6de35a )
by Adam
16:39 queued 03:06
created

ContactDataSet::createQueryBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
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\Front;
14
15
use Doctrine\ORM\QueryBuilder;
16
use WellCommerce\Bundle\CmsBundle\DataSet\Admin\ContactDataSet as BaseDataSet;
17
18
/**
19
 * Class ContactDataSet
20
 *
21
 * @author Adam Piotrowski <[email protected]>
22
 */
23
class ContactDataSet extends BaseDataSet
24
{
25
    public function getIdentifier(): string
26
    {
27
        return 'front.contact';
28
    }
29
    
30
    protected function createQueryBuilder(): QueryBuilder
31
    {
32
        $queryBuilder = $this->repository->getQueryBuilder();
33
        $queryBuilder->groupBy('contact.id');
34
        $queryBuilder->leftJoin('contact.translations', 'contact_translation');
35
        $queryBuilder->leftJoin('contact.shops', 'contact_shops');
36
        $queryBuilder->andWhere($queryBuilder->expr()->eq('contact_shops.id', $this->getShopStorage()->getCurrentShopIdentifier()));
37
        
38
        return $queryBuilder;
39
    }
40
}
41