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\CatalogBundle\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
|
|
|
/** |
21
|
|
|
* Class ProducerCollectionDataSet |
22
|
|
|
* |
23
|
|
|
* @author Rafał Martonik <[email protected]> |
24
|
|
|
*/ |
25
|
|
|
class ProducerCollectionDataSet extends AbstractDataSet |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* {@inheritdoc} |
29
|
|
|
*/ |
30
|
|
|
|
31
|
|
|
public function getIdentifier(): string |
32
|
|
|
{ |
33
|
|
|
return 'admin.producer_collection'; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function configureOptions(DataSetConfiguratorInterface $configurator) |
37
|
|
|
{ |
38
|
|
|
$configurator->setColumns([ |
39
|
|
|
'id' => 'producer_collection.id', |
40
|
|
|
'name' => 'producer_collection_translation.name', |
41
|
|
|
'producerName' => 'producer_translation.name', |
42
|
|
|
]); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
protected function createQueryBuilder() : QueryBuilder |
46
|
|
|
{ |
47
|
|
|
$queryBuilder = $this->repository->getQueryBuilder(); |
48
|
|
|
$queryBuilder->groupBy('producer_collection.id'); |
49
|
|
|
$queryBuilder->leftJoin('producer_collection.translations', 'producer_collection_translation'); |
50
|
|
|
$queryBuilder->leftJoin('producer_collection.producer', 'producer_info'); |
51
|
|
|
$queryBuilder->leftJoin('producer_info.translations', 'producer_translation'); |
52
|
|
|
$queryBuilder->leftJoin('producer_collection.shops', 'producer_collection_shops'); |
53
|
|
|
$queryBuilder->where($queryBuilder->expr()->eq('producer_collection_shops.id', |
54
|
|
|
$this->getShopStorage()->getCurrentShopIdentifier())); |
55
|
|
|
|
56
|
|
|
return $queryBuilder; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
} |
60
|
|
|
|