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