These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
0 ignored issues
–
show
|
|||
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\Admin; |
||
15 | |||
16 | use Knp\Menu\ItemInterface as MenuItemInterface; |
||
17 | use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||
18 | use Sonata\AdminBundle\Datagrid\ListMapper; |
||
19 | use Sonata\AdminBundle\Datagrid\ProxyQueryInterface; |
||
20 | use Sonata\AdminBundle\Form\FormMapper; |
||
21 | use Sonata\AdminBundle\Route\RouteCollection; |
||
22 | use Sonata\AdminBundle\Show\ShowMapper; |
||
23 | use Sonata\Form\Validator\ErrorElement; |
||
24 | |||
25 | /** |
||
26 | * @author Thomas Rabaix <[email protected]> |
||
27 | */ |
||
28 | interface AdminExtensionInterface |
||
29 | { |
||
30 | public function configureFormFields(FormMapper $formMapper); |
||
31 | |||
32 | public function configureListFields(ListMapper $listMapper); |
||
33 | |||
34 | public function configureDatagridFilters(DatagridMapper $datagridMapper); |
||
35 | |||
36 | public function configureShowFields(ShowMapper $showMapper); |
||
37 | |||
38 | public function configureRoutes(AdminInterface $admin, RouteCollection $collection); |
||
39 | |||
40 | /** |
||
41 | * DEPRECATED: Use configureTabMenu instead. |
||
42 | * |
||
43 | * NEXT_MAJOR: remove this method. |
||
44 | * |
||
45 | * @param string $action |
||
46 | * |
||
47 | * @deprecated |
||
48 | */ |
||
49 | public function configureSideMenu( |
||
50 | AdminInterface $admin, |
||
51 | MenuItemInterface $menu, |
||
52 | $action, |
||
53 | AdminInterface $childAdmin = null |
||
54 | ); |
||
55 | |||
56 | /** |
||
57 | * Builds the tab menu. |
||
58 | * |
||
59 | * @param string $action |
||
60 | */ |
||
61 | public function configureTabMenu( |
||
62 | AdminInterface $admin, |
||
63 | MenuItemInterface $menu, |
||
64 | $action, |
||
65 | AdminInterface $childAdmin = null |
||
66 | ); |
||
67 | |||
68 | /** |
||
69 | * @param mixed $object |
||
70 | */ |
||
71 | public function validate(AdminInterface $admin, ErrorElement $errorElement, $object); |
||
72 | |||
73 | /** |
||
74 | * @param string $context |
||
75 | */ |
||
76 | public function configureQuery(AdminInterface $admin, ProxyQueryInterface $query, $context = 'list'); |
||
77 | |||
78 | /** |
||
79 | * Get a chance to modify a newly created instance. |
||
80 | * |
||
81 | * @param mixed $object |
||
82 | */ |
||
83 | public function alterNewInstance(AdminInterface $admin, $object); |
||
84 | |||
85 | /** |
||
86 | * Get a chance to modify object instance. |
||
87 | * |
||
88 | * @param mixed $object |
||
89 | */ |
||
90 | public function alterObject(AdminInterface $admin, $object); |
||
91 | |||
92 | /** |
||
93 | * Get a chance to add persistent parameters. |
||
94 | * |
||
95 | * @return array |
||
96 | */ |
||
97 | public function getPersistentParameters(AdminInterface $admin); |
||
98 | |||
99 | /** |
||
100 | * Return the controller access mapping. |
||
101 | * |
||
102 | * @return array |
||
103 | */ |
||
104 | public function getAccessMapping(AdminInterface $admin); |
||
105 | |||
106 | /** |
||
107 | * Returns the list of batch actions. |
||
108 | * |
||
109 | * @param array $actions |
||
110 | * |
||
111 | * @return array |
||
112 | */ |
||
113 | public function configureBatchActions(AdminInterface $admin, array $actions); |
||
114 | |||
115 | /** |
||
116 | * Get a chance to modify export fields. |
||
117 | * |
||
118 | * @param string[] $fields |
||
119 | * |
||
120 | * @return string[] |
||
121 | */ |
||
122 | // TODO: Uncomment in next major release |
||
123 | // public function configureExportFields(AdminInterface $admin, array $fields); |
||
124 | |||
125 | /** |
||
126 | * @param mixed $object |
||
127 | */ |
||
128 | public function preUpdate(AdminInterface $admin, $object); |
||
129 | |||
130 | /** |
||
131 | * @param mixed $object |
||
132 | */ |
||
133 | public function postUpdate(AdminInterface $admin, $object); |
||
134 | |||
135 | /** |
||
136 | * @param mixed $object |
||
137 | */ |
||
138 | public function prePersist(AdminInterface $admin, $object); |
||
139 | |||
140 | /** |
||
141 | * @param mixed $object |
||
142 | */ |
||
143 | public function postPersist(AdminInterface $admin, $object); |
||
144 | |||
145 | /** |
||
146 | * @param mixed $object |
||
147 | */ |
||
148 | public function preRemove(AdminInterface $admin, $object); |
||
149 | |||
150 | /** |
||
151 | * @param mixed $object |
||
152 | */ |
||
153 | public function postRemove(AdminInterface $admin, $object); |
||
154 | |||
155 | /** |
||
156 | * Get all action buttons for an action. |
||
157 | * |
||
158 | * @param array $list |
||
159 | * @param string $action |
||
160 | * @param object $object |
||
161 | * |
||
162 | * @return array |
||
163 | */ |
||
164 | public function configureActionButtons(AdminInterface $admin, $list, $action, $object); |
||
165 | |||
166 | /* |
||
167 | * NEXT_MAJOR: Uncomment in next major release |
||
168 | * |
||
169 | * Returns a list of default filters |
||
170 | * |
||
171 | * @param array $filterValues |
||
172 | */ |
||
173 | // public function configureDefaultFilterValues(AdminInterface $admin, array &$filterValues); |
||
174 | } |
||
175 | |||
176 | class_exists(\Sonata\Form\Validator\ErrorElement::class); |
||
177 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.