Completed
Push — 3.x ( fafa70...5d69f2 )
by Vincent
03:36 queued 41s
created

ModelManager::getDefaultPerPageOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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
    /**
25
     * @var FooRepository
26
     */
27
    private $repository;
28
29
    public function __construct(FooRepository $repository)
30
    {
31
        $this->repository = $repository;
32
    }
33
34
    public function getNewFieldDescriptionInstance($class, $name, array $options = [])
35
    {
36
        if (!isset($options['route']['name'])) {
37
            $options['route']['name'] = 'edit';
38
        }
39
40
        if (!isset($options['route']['parameters'])) {
41
            $options['route']['parameters'] = [];
42
        }
43
44
        $fieldDescription = new FieldDescription();
45
        $fieldDescription->setName($name);
46
        $fieldDescription->setOptions($options);
47
48
        return $fieldDescription;
49
    }
50
51
    public function create($object)
52
    {
53
    }
54
55
    public function update($object)
56
    {
57
    }
58
59
    public function delete($object)
60
    {
61
    }
62
63
    public function findBy($class, array $criteria = [])
64
    {
65
        return [];
66
    }
67
68
    public function findOneBy($class, array $criteria = [])
69
    {
70
        return null;
71
    }
72
73
    public function find($class, $id)
74
    {
75
        return $this->repository->byId($id);
76
    }
77
78
    public function batchDelete($class, ProxyQueryInterface $queryProxy)
79
    {
80
    }
81
82
    public function getParentFieldDescription($parentAssociationMapping, $class)
83
    {
84
        throw new \BadMethodCallException('Not implemented.');
85
    }
86
87
    public function createQuery($class, $alias = 'o')
88
    {
89
    }
90
91
    public function getModelIdentifier($class)
92
    {
93
        return 'id';
94
    }
95
96
    public function getIdentifierValues($model)
97
    {
98
        return [];
99
    }
100
101
    public function getIdentifierFieldNames($class)
102
    {
103
        return [];
104
    }
105
106
    public function getNormalizedIdentifier($model)
107
    {
108
        return null;
109
    }
110
111
    public function getUrlSafeIdentifier($model)
112
    {
113
        return $model->getId();
114
    }
115
116
    public function getModelInstance($class)
117
    {
118
        return new Foo('test_id', 'foo_name');
119
    }
120
121
    public function getModelCollectionInstance($class)
122
    {
123
        return [];
124
    }
125
126
    public function collectionRemoveElement(&$collection, &$element)
127
    {
128
    }
129
130
    public function collectionAddElement(&$collection, &$element)
131
    {
132
    }
133
134
    public function collectionHasElement(&$collection, &$element)
135
    {
136
    }
137
138
    public function collectionClear(&$collection)
139
    {
140
    }
141
142
    public function getSortParameters(FieldDescriptionInterface $fieldDescription, DatagridInterface $datagrid)
143
    {
144
        return [];
145
    }
146
147
    public function getDefaultSortValues($class)
148
    {
149
        return [];
150
    }
151
152
    public function getDefaultPerPageOptions(string $class): array
0 ignored issues
show
Unused Code introduced by
The parameter $class is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
153
    {
154
        return [];
155
    }
156
157
    public function modelReverseTransform($class, array $array = [])
158
    {
159
        throw new \BadMethodCallException('Not implemented.');
160
    }
161
162
    public function modelTransform($class, $instance)
163
    {
164
        throw new \BadMethodCallException('Not implemented.');
165
    }
166
167
    public function executeQuery($query)
168
    {
169
    }
170
171
    public function getDataSourceIterator(DatagridInterface $datagrid, array $fields, $firstResult = null, $maxResult = null)
172
    {
173
    }
174
175
    public function getExportFields($class)
176
    {
177
        return [];
178
    }
179
180
    public function getPaginationParameters(DatagridInterface $datagrid, $page)
181
    {
182
        return [];
183
    }
184
185
    public function addIdentifiersToQuery($class, ProxyQueryInterface $query, array $idx)
186
    {
187
    }
188
}
189