You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 line
1013B

  1. <?php
  2. namespace Lc\SovBundle\EventListener;
  3. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  4. use Symfony\Component\HttpKernel\Event\ExceptionEvent;
  5. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  6. class ExceptionListener
  7. {
  8. public function __construct(
  9. SessionInterface $session
  10. ) {
  11. $this->session = $session;
  12. }
  13. public function onKernelException(ExceptionEvent $event)
  14. {
  15. // You get the exception object from the received event
  16. $exception = $event->getThrowable();
  17. // On détecte une erreur interne (500), on remove les sessions qui servent de filtre dans l'admin
  18. /*if ($exception instanceof HttpExceptionInterface != true) {
  19. if (!headers_sent()) {
  20. foreach ($this->session->all() as $key => $s) {
  21. if (str_contains($key, "_filter")) {
  22. $this->session->remove($key);
  23. }
  24. }
  25. }
  26. }*/
  27. }
  28. }