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\Model; |
15
|
|
|
|
16
|
|
|
use Sonata\AdminBundle\Admin\FieldDescriptionInterface; |
17
|
|
|
use Sonata\AdminBundle\Datagrid\DatagridInterface; |
18
|
|
|
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface; |
19
|
|
|
use Sonata\AdminBundle\Model\ModelManagerInterface; |
20
|
|
|
use Sonata\AdminBundle\Tests\App\Admin\FieldDescription; |
21
|
|
|
|
22
|
|
|
final class ModelManager implements ModelManagerInterface |
23
|
|
|
{ |
24
|
|
|
private $repository; |
25
|
|
|
|
26
|
|
|
public function __construct(FooRepository $repository) |
27
|
|
|
{ |
28
|
|
|
$this->repository = $repository; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function getNewFieldDescriptionInstance($class, $name, array $options = []) |
32
|
|
|
{ |
33
|
|
|
if (!isset($options['route']['name'])) { |
34
|
|
|
$options['route']['name'] = 'edit'; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
if (!isset($options['route']['parameters'])) { |
38
|
|
|
$options['route']['parameters'] = []; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
$fieldDescription = new FieldDescription(); |
42
|
|
|
$fieldDescription->setName($name); |
43
|
|
|
$fieldDescription->setOptions($options); |
44
|
|
|
|
45
|
|
|
return $fieldDescription; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function create($object) |
49
|
|
|
{ |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function update($object) |
53
|
|
|
{ |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function delete($object) |
57
|
|
|
{ |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function findBy($class, array $criteria = []) |
61
|
|
|
{ |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function findOneBy($class, array $criteria = []) |
65
|
|
|
{ |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function find($class, $id) |
69
|
|
|
{ |
70
|
|
|
return $this->repository->byId($id); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function batchDelete($class, ProxyQueryInterface $queryProxy) |
74
|
|
|
{ |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function getParentFieldDescription($parentAssociationMapping, $class) |
78
|
|
|
{ |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function createQuery($class, $alias = 'o') |
82
|
|
|
{ |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function getModelIdentifier($class) |
86
|
|
|
{ |
87
|
|
|
return 'id'; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function getIdentifierValues($model) |
91
|
|
|
{ |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function getIdentifierFieldNames($class) |
95
|
|
|
{ |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getNormalizedIdentifier($model) |
99
|
|
|
{ |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function getUrlsafeIdentifier($model) |
103
|
|
|
{ |
104
|
|
|
return $model->getId(); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
public function getModelInstance($class) |
108
|
|
|
{ |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
public function getModelCollectionInstance($class) |
112
|
|
|
{ |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
public function collectionRemoveElement(&$collection, &$element) |
116
|
|
|
{ |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function collectionAddElement(&$collection, &$element) |
120
|
|
|
{ |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
public function collectionHasElement(&$collection, &$element) |
124
|
|
|
{ |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
public function collectionClear(&$collection) |
128
|
|
|
{ |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
public function getSortParameters(FieldDescriptionInterface $fieldDescription, DatagridInterface $datagrid) |
132
|
|
|
{ |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
public function getDefaultSortValues($class) |
136
|
|
|
{ |
137
|
|
|
return []; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
public function modelReverseTransform($class, array $array = []) |
141
|
|
|
{ |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
public function modelTransform($class, $instance) |
145
|
|
|
{ |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
public function executeQuery($query) |
149
|
|
|
{ |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
public function getDataSourceIterator(DatagridInterface $datagrid, array $fields, $firstResult = null, $maxResult = null) |
153
|
|
|
{ |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
public function getExportFields($class) |
157
|
|
|
{ |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
public function getPaginationParameters(DatagridInterface $datagrid, $page) |
161
|
|
|
{ |
162
|
|
|
return []; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
public function addIdentifiersToQuery($class, ProxyQueryInterface $query, array $idx) |
166
|
|
|
{ |
167
|
|
|
} |
168
|
|
|
} |
169
|
|
|
|