Completed
Push — master ( aba493...5356ed )
by Ruud
315:38 queued 305:00
created

Configurator/AdminListConfiguratorInterface.php (1 issue)

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