1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Sonata Project package. |
7
|
|
|
* |
8
|
|
|
* (c) Thomas Rabaix <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Sonata\AdminBundle\Tests\App\Datagrid; |
15
|
|
|
|
16
|
|
|
use Sonata\AdminBundle\Admin\FieldDescriptionInterface; |
17
|
|
|
use Sonata\AdminBundle\Datagrid\DatagridInterface; |
18
|
|
|
use Sonata\AdminBundle\Datagrid\PagerInterface; |
19
|
|
|
use Sonata\AdminBundle\Filter\FilterInterface; |
20
|
|
|
use Symfony\Component\Form\Extension\Core\Type\FormType; |
21
|
|
|
use Symfony\Component\Form\FormFactoryInterface; |
22
|
|
|
|
23
|
|
|
final class Datagrid implements DatagridInterface |
24
|
|
|
{ |
25
|
|
|
private $formFactory; |
26
|
|
|
private $pager; |
27
|
|
|
|
28
|
|
|
public function __construct(FormFactoryInterface $formFactory, PagerInterface $pager) |
29
|
|
|
{ |
30
|
|
|
$this->formFactory = $formFactory; |
31
|
|
|
$this->pager = $pager; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function getSortParameters(FieldDescriptionInterface $fieldDescription) |
|
|
|
|
35
|
|
|
{ |
36
|
|
|
return []; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function getPaginationParameters(int $page) |
|
|
|
|
40
|
|
|
{ |
41
|
|
|
return []; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function getPager() |
45
|
|
|
{ |
46
|
|
|
return $this->pager; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function getQuery() |
50
|
|
|
{ |
51
|
|
|
throw new \BadMethodCallException('Not implemented.'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getResults() |
55
|
|
|
{ |
56
|
|
|
return $this->pager->getResults(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function buildPager() |
60
|
|
|
{ |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function addFilter(FilterInterface $filter) |
64
|
|
|
{ |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function getFilters() |
68
|
|
|
{ |
69
|
|
|
return []; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function reorderFilters(array $keys) |
73
|
|
|
{ |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function getValues() |
77
|
|
|
{ |
78
|
|
|
return []; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function getColumns() |
82
|
|
|
{ |
83
|
|
|
throw new \BadMethodCallException('Not implemented.'); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function setValue($name, $operator, $value) |
87
|
|
|
{ |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function getForm() |
91
|
|
|
{ |
92
|
|
|
return $this->formFactory->createNamedBuilder('filter', FormType::class, [])->getForm(); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function getFilter($name) |
96
|
|
|
{ |
97
|
|
|
throw new \BadMethodCallException('Not implemented.'); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public function hasFilter($name) |
101
|
|
|
{ |
102
|
|
|
return false; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function removeFilter($name) |
106
|
|
|
{ |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function hasActiveFilters() |
110
|
|
|
{ |
111
|
|
|
return false; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function hasDisplayableFilters() |
115
|
|
|
{ |
116
|
|
|
return false; |
117
|
|
|
} |
118
|
|
|
} |
119
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.