Completed
Pull Request — 5.6 (#2830)
by Jeroen
14:14
created

Configurator/AdminListConfiguratorInterface.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\AdminListBundle\AdminList\Configurator;
4
5
use InvalidArgumentException;
6
use Kunstmaan\AdminListBundle\AdminList\BulkAction\BulkActionInterface;
7
use Kunstmaan\AdminListBundle\AdminList\Field;
8
use Kunstmaan\AdminListBundle\AdminList\FilterBuilder;
9
use Kunstmaan\AdminListBundle\AdminList\ItemAction\ItemActionInterface;
10
use Kunstmaan\AdminListBundle\AdminList\ListAction\ListActionInterface;
11
use Pagerfanta\Pagerfanta;
12
use Symfony\Component\HttpFoundation\Request;
13
14
/**
15
 * Implement this interface to create your own admin list
16
 */
17
interface AdminListConfiguratorInterface
18
{
19
    /**
20
     * Configure the visible columns
21
     */
22
    public function buildFields();
23
24
    /**
25
     * Configure the fields you can filter on
26
     */
27
    public function buildFilters();
0 ignored issues
show
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
28
29
    /**
30
     * Configure the actions for each item
31
     */
32
    public function buildItemActions();
0 ignored issues
show
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
33
34
    /**
35
     * Configure the actions that can be executed on the whole list
36
     */
37
    public function buildListActions();
0 ignored issues
show
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
38
39
    /**
40
     * Return the url to edit the given $item
41
     *
42
     * @param object|array $item
43
     *
44
     * @return array
45
     */
46
    public function getEditUrlFor($item);
47
48
    /**
49
     * Configure the types of items you can add
50
     *
51
     * @return array
52
     */
53
    public function getAddUrlFor(array $params = []);
54
55
    /**
56
     * Get the delete url for the given $item
57
     *
58
     * @param object|array $item
59
     *
60
     * @return array
61
     */
62
    public function getDeleteUrlFor($item);
63
64
    /**
65
     * Return the url to list all the items
66
     *
67
     * @return array
68
     */
69
    public function getIndexUrl();
70
71
    /**
72
     * Get the url to export the listed items
73
     *
74
     * @return array
75
     */
76
    public function getExportUrl();
77
78
    /**
79
     * Get the view url for the given $item
80
     *
81
     * @param object|array $item
82
     *
83
     * @return array
84
     */
85
    public function getViewUrlFor($item);
86
87
    /**
88
     * @param object $entity
89
     *
90
     * @throws InvalidArgumentException
91
     *
92
     * @return string FQCN of form type
93
     */
94
    public function getAdminType($entity);
95
96
    /**
97
     * @param object|array $item
98
     *
99
     * @return bool
100
     */
101
    public function canEdit($item);
102
103
    public function canView($item);
104
105
    /**
106
     * Configure if it's possible to delete the given $item
107
     *
108
     * @param object|array $item
109
     *
110
     * @return bool
111
     */
112
    public function canDelete($item);
113
114
    /**
115
     * Configure if it's possible to add new items
116
     *
117
     * @return bool
118
     */
119
    public function canAdd();
120
121
    /**
122
     * Configure if it's possible to add new items
123
     *
124
     * @return bool
125
     */
126
    public function canExport();
127
128
    /**
129
     * @return array
130
     */
131
    public function getSortFields();
132
133
    /**
134
     * @return Field[]
135
     */
136
    public function getFields();
137
138
    /**
139
     * @return Field[]
140
     */
141
    public function getExportFields();
142
143
    /**
144
     * @return bool
145
     */
146
    public function hasItemActions();
147
148
    /**
149
     * @return ItemActionInterface[]
150
     */
151
    public function getItemActions();
152
153
    /**
154
     * @return bool
155
     */
156
    public function hasListActions();
157
158
    /**
159
     * @return ListActionInterface[]
160
     */
161
    public function getListActions();
162
163
    /**
164
     * @return bool
165
     */
166
    public function hasBulkActions();
167
168
    /**
169
     * @return BulkActionInterface[]
170
     */
171
    public function getBulkActions();
172
173
    /**
174
     * @param array|object $item       The item
175
     * @param string       $columnName The column name
176
     *
177
     * @return mixed
178
     */
179
    public function getValue($item, $columnName);
180
181
    /**
182
     * @param array|object $item       The item
183
     * @param string       $columnName The column name
184
     *
185
     * @return string
186
     */
187
    public function getStringValue($item, $columnName);
188
189
    /**
190
     * @return string
191
     */
192
    public function getListTemplate();
193
194
    /**
195
     * @return string
196
     */
197
    public function getAddTemplate();
198
199
    /**
200
     * @return string
201
     */
202
    public function getEditTemplate();
203
204
    /**
205
     * @return string
206
     */
207
    public function getDeleteTemplate();
208
209
    /**
210
     * You can override this method to do some custom things you need to do when adding an entity
211
     *
212
     * @param object $entity
213
     *
214
     * @return mixed
215
     */
216
    public function decorateNewEntity($entity);
217
218
    /**
219
     * Return total number of items.
220
     *
221
     * @return int
222
     */
223
    public function getCount();
224
225
    /**
226
     * Return items on current page.
227
     *
228
     * @return mixed
229
     */
230
    public function getItems();
231
232
    /**
233
     * Bind request
234
     */
235
    public function bindRequest(Request $request);
236
237
    /**
238
     * Get current pagerfanta
239
     *
240
     * @return Pagerfanta
241
     */
242
    public function getPagerfanta();
243
244
    /**
245
     * @return FilterBuilder
246
     */
247
    public function getFilterBuilder();
248
249
    /**
250
     * Return current sorting column.
251
     *
252
     * @return string
253
     */
254
    public function getOrderBy();
255
256
    /**
257
     * Return current sorting direction.
258
     *
259
     * @return string
260
     */
261
    public function getOrderDirection();
262
263
    /**
264
     * Return extra parameters for use in list actions.
265
     *
266
     * @return array
267
     */
268
    public function getExtraParameters();
269
}
270