| Conditions | 3 |
| Paths | 3 |
| Total Lines | 28 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function handle(FormInterface $form, AdminInterface $admin) |
||
| 34 | { |
||
| 35 | if ($form->isValid()) { |
||
| 36 | // remove the current entity |
||
| 37 | $admin->remove(); |
||
| 38 | |||
| 39 | // redirect to list if the action exist |
||
| 40 | $allowedActions = $admin |
||
| 41 | ->getConfiguration() |
||
| 42 | ->getParameter('actions') |
||
| 43 | ; |
||
| 44 | |||
| 45 | if (array_key_exists('list', $allowedActions)) { |
||
| 46 | $url = $this |
||
| 47 | ->router |
||
| 48 | ->generate($admin->generateRouteName('list')); |
||
| 49 | |||
| 50 | return new RedirectResponse($url); |
||
| 51 | } |
||
| 52 | return new RedirectResponse('/'); |
||
| 53 | } |
||
| 54 | $url = $this |
||
| 55 | ->router |
||
| 56 | ->generate($admin->generateRouteName('delete')) |
||
| 57 | ; |
||
| 58 | |||
| 59 | return new RedirectResponse($url); |
||
| 60 | } |
||
| 61 | } |
||
| 62 |