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\ShipmentBundle\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 ShipmentDataSet |
21
|
|
|
* |
22
|
|
|
* @author Adam Piotrowski <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
class ShipmentDataSet extends AbstractDataSet |
25
|
|
|
{ |
26
|
|
|
public function getIdentifier(): string |
27
|
|
|
{ |
28
|
|
|
return 'admin.shipment'; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function configureOptions(DataSetConfiguratorInterface $configurator) |
32
|
|
|
{ |
33
|
|
|
$configurator->setColumns([ |
34
|
|
|
'id' => 'shipment.id', |
35
|
|
|
'orderNumber' => 'orders.number', |
36
|
|
|
'guid' => 'shipment.guid', |
37
|
|
|
'packageNumber' => 'shipment.packageNumber', |
38
|
|
|
'courier' => 'shipment.courier', |
39
|
|
|
'createdAt' => 'shipment.createdAt', |
40
|
|
|
]); |
41
|
|
|
|
42
|
|
|
$configurator->setColumnTransformers([ |
43
|
|
|
'createdAt' => $this->manager->createTransformer('date', ['format' => 'Y-m-d H:i:s']), |
44
|
|
|
]); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
protected function createQueryBuilder(): QueryBuilder |
48
|
|
|
{ |
49
|
|
|
$queryBuilder = $this->repository->getQueryBuilder(); |
50
|
|
|
$queryBuilder->leftJoin('shipment.order', 'orders'); |
51
|
|
|
$queryBuilder->groupBy('shipment.id'); |
52
|
|
|
|
53
|
|
|
return $queryBuilder; |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|